:root {
  --ink: #121b29;
  --muted: #5d6878;
  --line: #dfe5ee;
  --line-strong: #c6d0de;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --paper: #f7f8fb;
  --navy: #163765;
  --navy-dark: #102742;
  --blue: #2d6fb6;
  --red: #b2303d;
  --red-dark: #8e2330;
  --gold: #b98a3b;
  --green: #2f765f;
  --shadow: 0 18px 42px rgba(18, 27, 41, 0.11);
  --shadow-soft: 0 10px 28px rgba(18, 27, 41, 0.08);
  --focus: 0 0 0 4px rgba(45, 111, 182, 0.18);
}

/* Modern administration console */
body.admin-mode {
  --admin-navy: #05284d;
  --admin-blue: #0b5bd3;
  --admin-red: #e11d48;
  --admin-orange: #f97316;
  --admin-green: #15985b;
  --admin-ink: #071a3d;
  --admin-muted: #64728a;
  --admin-line: #dbe3ef;
  --admin-shadow: 0 14px 34px rgba(13, 31, 61, 0.08);
  background: #f5f7fb;
}

body.admin-mode input,
body.admin-mode select,
body.admin-mode textarea,
body.admin-mode button {
  font: inherit;
}

body.admin-mode .admin-shell {
  grid-template-columns: 206px minmax(0, 1fr);
  color: var(--admin-ink);
  background: #f5f7fb;
}

body.admin-mode .admin-sidebar {
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  background: linear-gradient(180deg, #062b52 0%, #031d3d 58%, #021832 100%);
  overflow: hidden;
}

body.admin-mode .admin-brand {
  gap: 12px;
  padding: 0 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

body.admin-mode .brand-assembly {
  position: relative;
  width: 48px;
  height: 36px;
  flex: 0 0 auto;
  display: block;
  color: #fff;
  background:
    linear-gradient(currentColor, currentColor) 6px 28px / 36px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 7px 11px / 4px 16px no-repeat,
    linear-gradient(currentColor, currentColor) 17px 11px / 4px 16px no-repeat,
    linear-gradient(currentColor, currentColor) 27px 11px / 4px 16px no-repeat,
    linear-gradient(currentColor, currentColor) 37px 11px / 4px 16px no-repeat;
}

body.admin-mode .brand-assembly::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 40px;
  height: 9px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

body.admin-mode .admin-brand strong {
  display: block;
  color: #fff;
  font-size: 1.08rem;
  line-height: 1.05;
}

body.admin-mode .admin-brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 650;
}

body.admin-mode .admin-sidebar nav {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

body.admin-mode .admin-nav-group {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

body.admin-mode .admin-nav-group:last-child {
  border-bottom: 0;
}

body.admin-mode .admin-sidebar nav button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 760;
}

body.admin-mode .admin-sidebar nav button::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 5px;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="check"]::before {
  border-radius: 5px;
  background:
    linear-gradient(135deg, transparent 45%, currentColor 46% 58%, transparent 59%) 5px 7px / 8px 8px no-repeat,
    linear-gradient(45deg, transparent 45%, currentColor 46% 58%, transparent 59%) 10px 3px / 8px 14px no-repeat;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="doc"]::before,
body.admin-mode .admin-sidebar nav button[data-admin-icon="file"]::before {
  border-radius: 4px;
  background:
    linear-gradient(currentColor, currentColor) 5px 7px / 9px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 5px 12px / 7px 2px no-repeat;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="users"]::before,
body.admin-mode .admin-sidebar nav button[data-admin-icon="contact"]::before {
  border-radius: 999px;
  box-shadow: 10px 7px 0 -5px currentColor, -10px 7px 0 -5px currentColor;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="search"]::before {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 8px 8px 0 -6px currentColor;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="star"]::before {
  border: 0;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 34%, 97% 34%, 68% 55%, 79% 90%, 50% 69%, 21% 90%, 32% 55%, 3% 34%, 39% 34%);
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="mail"]::before {
  background:
    linear-gradient(135deg, transparent 48%, currentColor 49% 56%, transparent 57%) 2px 4px / 16px 12px no-repeat,
    linear-gradient(45deg, transparent 48%, currentColor 49% 56%, transparent 57%) 2px 4px / 16px 12px no-repeat;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="chart"]::before {
  border-radius: 4px;
  background:
    linear-gradient(currentColor, currentColor) 4px 11px / 3px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 7px / 3px 9px no-repeat,
    linear-gradient(currentColor, currentColor) 14px 4px / 3px 12px no-repeat;
}

body.admin-mode .admin-sidebar nav button[data-admin-icon="settings"]::before {
  border-radius: 999px;
  background: radial-gradient(circle, transparent 0 4px, currentColor 4.5px 6px, transparent 6.5px);
}

body.admin-mode .admin-sidebar nav button.is-active,
body.admin-mode .admin-sidebar nav button:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(24, 96, 171, 0.88), rgba(14, 67, 127, 0.72));
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 8px 18px rgba(0, 13, 35, 0.18);
}

body.admin-mode .admin-nav-label {
  min-width: 0;
  width: auto;
  height: auto;
  display: block;
  overflow: hidden;
  color: inherit;
  background: transparent;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  place-items: initial;
}

body.admin-mode .admin-nav-count,
body.admin-mode .admin-notification-pill {
  min-width: 21px;
  height: 21px;
  font-size: 0.72rem;
  background: var(--admin-red);
}

body.admin-mode .admin-mandate-card {
  min-height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  margin-top: 0;
  padding: 11px 8px;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, rgba(52, 118, 185, 0.18), rgba(255, 255, 255, 0.04));
  border-radius: 8px;
  font-weight: 800;
}

body.admin-mode .admin-sidebar #leave-admin {
  min-height: 36px;
  flex: 0 0 auto;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

body.admin-mode .admin-workbench {
  padding: 0;
  overflow: clip;
}

body.admin-mode .admin-topbar {
  grid-template-columns: 36px minmax(320px, 1fr) auto minmax(220px, auto);
  min-height: 62px;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--admin-line);
  box-shadow: 0 10px 24px rgba(13, 31, 61, 0.04);
}

body.admin-mode .admin-menu-button,
body.admin-mode .admin-icon-action {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--admin-ink);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 7px;
}

body.admin-mode .admin-menu-button::before {
  content: "";
  display: block;
  width: 18px;
  height: 12px;
  margin: auto;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 18px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 5px / 18px 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 10px / 18px 2px no-repeat;
}

body.admin-mode .admin-global-search {
  position: relative;
  max-width: 690px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: #fff;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  box-shadow: inset 0 1px 2px rgba(13, 31, 61, 0.03);
}

body.admin-mode .admin-global-search::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 14px;
  border: 2px solid #8b98ad;
  border-radius: 999px;
  box-shadow: 8px 8px 0 -6px #8b98ad;
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
}

body.admin-mode .admin-global-search input {
  grid-column: 1;
  grid-row: 1;
  min-height: 42px;
  padding: 0 12px 0 42px;
  color: var(--admin-ink);
  background: transparent;
  border: 0;
  font-size: 0.94rem;
}

body.admin-mode .admin-global-search span {
  padding-right: 13px;
  color: #7b8799;
  font-size: 0.84rem;
  font-weight: 760;
}

body.admin-mode .admin-topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

body.admin-mode .admin-icon-action {
  position: relative;
}

body.admin-mode .admin-icon-action::before {
  content: "";
  width: 19px;
  height: 19px;
  display: block;
  margin: auto;
  border: 2px solid currentColor;
  border-radius: 5px;
}

body.admin-mode .admin-icon-action:first-child::before {
  border-radius: 999px 999px 6px 6px;
}

body.admin-mode .admin-icon-action.help::before {
  content: "?";
  display: grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
}

body.admin-mode .admin-icon-action span {
  position: absolute;
  top: -5px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--admin-red);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
}

body.admin-mode .admin-user-chip {
  display: grid;
  grid-template-columns: 38px minmax(0, auto) 16px;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 4px 8px;
  color: var(--admin-ink);
  background: transparent;
  border: 0;
  text-align: left;
}

body.admin-mode .admin-user-chip > span {
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #1f64b5, #0b315b);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

body.admin-mode .admin-user-chip strong,
body.admin-mode .admin-user-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-mode .admin-user-chip small {
  color: var(--admin-muted);
  font-size: 0.82rem;
}

body.admin-mode .admin-user-chip::after {
  content: "";
  grid-column: 3;
  grid-row: 1 / 3;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

body.admin-mode #admin-view {
  padding: 16px 14px 20px 20px;
}

body.admin-mode .admin-dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 394px;
  gap: 16px;
  align-items: start;
}

body.admin-mode .admin-dashboard-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

body.admin-mode .admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

body.admin-mode .admin-kpi-card,
body.admin-mode .admin-priority-card,
body.admin-mode .admin-panel,
body.admin-mode .admin-detail,
body.admin-mode .admin-form,
body.admin-mode .admin-filterbar,
body.admin-mode .admin-row,
body.admin-mode .activity-row {
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  box-shadow: var(--admin-shadow);
}

body.admin-mode .admin-kpi-card {
  min-height: 110px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  color: var(--admin-ink);
  text-align: left;
}

body.admin-mode .admin-kpi-card strong {
  display: block;
  color: #172744;
  font-size: 0.83rem;
  font-weight: 850;
}

body.admin-mode .admin-kpi-card span {
  display: block;
  margin-top: 10px;
  color: #071a3d;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
}

body.admin-mode .admin-kpi-card small {
  display: block;
  margin-top: 12px;
  color: var(--admin-muted);
  font-size: 0.82rem;
  font-weight: 720;
}

body.admin-mode .admin-kpi-card i {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  align-self: center;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4ff;
}

body.admin-mode .admin-kpi-card i::before {
  content: "";
  width: 24px;
  height: 24px;
  border: 5px solid var(--tone, var(--admin-blue));
  border-left-color: transparent;
  border-radius: 999px;
}

body.admin-mode .admin-kpi-card.tone-danger {
  --tone: var(--admin-red);
}

body.admin-mode .admin-kpi-card.tone-blue {
  --tone: var(--admin-blue);
}

body.admin-mode .admin-kpi-card.tone-orange {
  --tone: var(--admin-orange);
}

body.admin-mode .admin-kpi-card.tone-green {
  --tone: var(--admin-green);
}

body.admin-mode .admin-priority-card {
  min-height: 128px;
  padding: 16px;
}

body.admin-mode .admin-priority-card h3,
body.admin-mode .admin-priority-card p {
  margin: 0;
}

body.admin-mode .admin-priority-card h3 {
  margin-bottom: 12px;
  font-size: 0.9rem;
}

body.admin-mode .admin-priority-card p {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: #31425f;
  font-size: 0.86rem;
  font-weight: 760;
}

body.admin-mode .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--admin-blue);
}

body.admin-mode .dot.danger {
  background: var(--admin-red);
}

body.admin-mode .dot.navy {
  background: var(--admin-navy);
}

body.admin-mode .admin-task-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  box-shadow: var(--admin-shadow);
}

body.admin-mode .admin-task-lane {
  min-width: 0;
  display: grid;
  align-content: start;
  border-right: 1px solid var(--admin-line);
}

body.admin-mode .admin-task-lane:last-child {
  border-right: 0;
}

body.admin-mode .admin-task-lane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--admin-line);
}

body.admin-mode .admin-task-lane h3 {
  margin: 0;
  font-size: 0.92rem;
}

body.admin-mode .admin-task-lane h3 span {
  color: var(--admin-muted);
}

body.admin-mode .admin-task-lane header button {
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 0 7px;
  color: #31425f;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.admin-mode .dashboard-task-row {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  margin: 0;
  padding: 11px 12px 11px 18px;
  color: var(--admin-ink);
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--admin-line);
  border-radius: 0;
  box-shadow: none;
}

body.admin-mode .dashboard-task-row::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  background: var(--admin-blue);
  border-radius: 999px;
}

body.admin-mode .dashboard-task-row.priority-urgente::before,
body.admin-mode .dashboard-task-row.is-late::before {
  background: var(--admin-red);
}

body.admin-mode .dashboard-task-row.priority-importante::before {
  background: var(--admin-orange);
}

body.admin-mode .dashboard-task-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

body.admin-mode .dashboard-task-row span {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  color: #51617a;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-mode .dashboard-task-row time {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--admin-red);
  font-size: 0.78rem;
  font-weight: 850;
}

body.admin-mode .lane-link {
  width: auto;
  justify-self: start;
  min-height: 38px;
  margin: 4px 12px 10px;
  padding: 0;
  color: var(--admin-blue);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.84rem;
  font-weight: 850;
}

body.admin-mode .admin-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

body.admin-mode .mail-composer,
body.admin-mode .team-load-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

body.admin-mode .mail-composer header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

body.admin-mode .mail-composer h3,
body.admin-mode .mail-composer p,
body.admin-mode .team-load-panel h3 {
  margin: 0;
}

body.admin-mode .mail-composer header p {
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 0.84rem;
}

body.admin-mode .mail-composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.9fr);
  gap: 14px;
}

body.admin-mode .mail-editor {
  display: grid;
  gap: 10px;
}

body.admin-mode .mail-editor input,
body.admin-mode .mail-editor textarea,
body.admin-mode .fake-toolbar,
body.admin-mode .mail-composer article {
  border: 1px solid var(--admin-line);
  border-radius: 6px;
}

body.admin-mode .mail-editor textarea {
  min-height: 170px;
  resize: vertical;
}

body.admin-mode .fake-toolbar {
  min-height: 38px;
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 0 10px;
  color: #31425f;
  background: #fff;
  font-size: 0.84rem;
}

body.admin-mode .mail-composer article {
  padding: 14px;
  background: #fbfdff;
}

body.admin-mode .mail-composer article h4 {
  margin: 0 0 10px;
}

body.admin-mode .mail-composer article p {
  margin-top: 10px;
  color: #263957;
  font-size: 0.88rem;
  line-height: 1.45;
}

body.admin-mode .team-load-panel {
  overflow: auto;
}

body.admin-mode .team-load-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

body.admin-mode .team-load-panel th,
body.admin-mode .team-load-panel td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--admin-line);
  text-align: left;
  white-space: nowrap;
}

body.admin-mode .team-load-panel th {
  color: #33445f;
  font-size: 0.72rem;
}

body.admin-mode .team-load-panel td:first-child {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 820;
}

body.admin-mode .mini-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #335f9d;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
}

body.admin-mode .loadbar {
  width: 70px;
  height: 5px;
  display: inline-flex;
  margin-right: 8px;
  vertical-align: middle;
  background: #dfe6ef;
  border-radius: 999px;
  overflow: hidden;
}

body.admin-mode .loadbar i {
  display: block;
  height: 100%;
  background: var(--bar, var(--admin-blue));
}

body.admin-mode .admin-inspector {
  position: sticky;
  top: 90px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

body.admin-mode .secure-badge {
  justify-self: end;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: #157448;
}

body.admin-mode .secure-badge::before {
  content: "";
  width: 28px;
  height: 34px;
  border: 3px solid currentColor;
  border-radius: 13px 13px 16px 16px;
  clip-path: polygon(50% 0, 100% 18%, 88% 78%, 50% 100%, 12% 78%, 0 18%);
}

body.admin-mode .secure-badge strong,
body.admin-mode .secure-badge span {
  display: block;
}

body.admin-mode .secure-badge strong {
  font-size: 0.86rem;
}

body.admin-mode .secure-badge span {
  font-size: 0.78rem;
}

body.admin-mode .selected-contact-card {
  display: grid;
  min-height: calc(100vh - 150px);
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

body.admin-mode .selected-contact-card > header,
body.admin-mode .selected-contact-identity,
body.admin-mode .selected-contact-card nav,
body.admin-mode .selected-contact-body,
body.admin-mode .selected-contact-card footer {
  padding-inline: 18px;
}

body.admin-mode .selected-contact-card > header {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

body.admin-mode .selected-contact-card h3,
body.admin-mode .selected-contact-card p,
body.admin-mode .selected-contact-card h4,
body.admin-mode .selected-contact-card dl {
  margin: 0;
}

body.admin-mode .selected-contact-card > header h3 {
  font-size: 0.95rem;
}

body.admin-mode .selected-contact-card > header span {
  color: var(--admin-muted);
  font-size: 0.78rem;
}

body.admin-mode .selected-contact-card > header button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  color: #243650;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
}

body.admin-mode .selected-contact-identity {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-block: 10px 18px;
  border-bottom: 1px solid var(--admin-line);
}

body.admin-mode .selected-contact-identity > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--admin-blue);
  background: #dceaff;
  border-radius: 999px;
  font-weight: 900;
}

body.admin-mode .selected-contact-identity strong {
  display: block;
  font-size: 1rem;
}

body.admin-mode .selected-contact-identity p {
  color: #52627a;
  font-size: 0.78rem;
}

body.admin-mode .selected-contact-identity button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--admin-blue);
  background: #eaf2ff;
  border: 0;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 850;
}

body.admin-mode .selected-contact-card nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--admin-line);
}

body.admin-mode .selected-contact-card nav button {
  min-height: 44px;
  padding: 0;
  color: #40526d;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 850;
}

body.admin-mode .selected-contact-card nav button.is-active {
  color: var(--admin-blue);
  border-bottom-color: var(--admin-blue);
}

body.admin-mode .selected-contact-body {
  display: grid;
  gap: 9px;
  align-content: start;
  padding-block: 16px;
}

body.admin-mode .selected-contact-body h4 {
  margin-top: 5px;
  color: #1a2d49;
  font-size: 0.86rem;
}

body.admin-mode .selected-contact-body p {
  color: #35445c;
  font-size: 0.88rem;
  line-height: 1.45;
}

body.admin-mode .selected-contact-body dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
  border-top: 1px solid var(--admin-line);
  border-left: 1px solid var(--admin-line);
}

body.admin-mode .selected-contact-body dl div {
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
}

body.admin-mode .selected-contact-body dt {
  color: #263957;
  font-size: 0.78rem;
  font-weight: 850;
}

body.admin-mode .selected-contact-body dd {
  margin: 5px 0 0;
  color: #52627a;
  font-size: 0.84rem;
}

body.admin-mode .selected-contact-card footer {
  align-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-block: 18px;
}

body.admin-mode .primary-action {
  color: #fff;
  background: var(--admin-blue);
  border-color: var(--admin-blue);
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(11, 91, 211, 0.18);
}

body.admin-mode .secondary-action,
body.admin-mode .import-button {
  color: var(--admin-blue);
  background: #fff;
  border-color: #a9c4ef;
  border-radius: 6px;
}

body.admin-mode .status-chip.urgency-critique,
body.admin-mode .status-chip.urgency-prioritaire {
  background: var(--admin-red);
}

body.admin-mode .status-chip.urgency-normal {
  background: var(--admin-green);
}

body.admin-mode .task-command-panel,
body.admin-mode .template-studio-head,
body.admin-mode .team-overview,
body.admin-mode .permanence-toolbar,
body.admin-mode .task-column,
body.admin-mode .kanban-column,
body.admin-mode .parliament-column,
body.admin-mode .task-card,
body.admin-mode .team-card,
body.admin-mode .parliament-card,
body.admin-mode .generated-template-preview,
body.admin-mode .template-context-form,
body.admin-mode .linked-task-list,
body.admin-mode .admin-comments {
  border-radius: 7px;
}

@media (max-width: 1400px) {
  body.admin-mode .admin-dashboard-shell {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  body.admin-mode .admin-kpi-grid {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  body.admin-mode .admin-task-overview {
    overflow-x: auto;
  }

  body.admin-mode .admin-task-lane {
    min-width: 230px;
  }

  body.admin-mode .admin-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  body.admin-mode .admin-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  body.admin-mode .admin-brand div,
  body.admin-mode .admin-nav-label,
  body.admin-mode .admin-mandate-card,
  body.admin-mode .admin-sidebar #leave-admin {
    display: none;
  }

  body.admin-mode .admin-sidebar nav button {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body.admin-mode .admin-dashboard-shell {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-inspector {
    position: static;
  }

  body.admin-mode .selected-contact-card {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body.admin-mode .admin-shell {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-sidebar {
    position: static;
    height: auto;
    display: grid;
  }

  body.admin-mode .admin-brand div,
  body.admin-mode .admin-nav-label {
    display: block;
  }

  body.admin-mode .admin-sidebar nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
  }

  body.admin-mode .admin-nav-group {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    border-bottom: 0;
  }

  body.admin-mode .admin-topbar {
    position: static;
    grid-template-columns: 44px 1fr;
  }

  body.admin-mode .admin-topbar-actions,
  body.admin-mode .admin-user-chip {
    display: none;
  }

  body.admin-mode #admin-view {
    padding: 12px;
  }

  body.admin-mode .admin-kpi-grid,
  body.admin-mode .mail-composer-grid,
  body.admin-mode .selected-contact-body dl,
  body.admin-mode .selected-contact-card footer {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-task-overview {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  body.admin-mode .admin-task-lane {
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--admin-line);
  }

  body.admin-mode .selected-contact-identity {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  body.admin-mode .selected-contact-identity button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  body.admin-mode .selected-contact-card nav {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(95px, 1fr));
  }
}

/* Onglets publics - ergonomie et mise en page corrigee */
body:not(.admin-mode) main {
  width: 100%;
}

body:not(.home-mode):not(.admin-mode) .workspace {
  width: min(100%, 1380px);
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body:not(.home-mode):not(.admin-mode) .tab-panel.is-active {
  width: 100%;
}

body.home-mode .workspace {
  max-width: 1380px;
  margin: 0 auto;
}

body.home-mode .summary-panel {
  grid-column: 1;
  grid-row: 1 / span 50;
}

body.home-mode .tab-panel {
  grid-column: 2;
}

.tab-panel {
  max-width: none;
  min-height: min(720px, calc(100vh - 170px));
  padding: clamp(22px, 3vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 254, 0.94)),
    radial-gradient(circle at 96% 0%, rgba(178, 48, 61, 0.05), transparent 30%);
}

.section-heading {
  position: relative;
  align-items: center;
  min-height: 86px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(198, 208, 222, 0.72);
}

.section-heading::before {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 78px;
  height: 3px;
  background: linear-gradient(90deg, var(--navy), var(--red));
  border-radius: 999px;
}

.section-heading .eyebrow {
  margin-bottom: 6px;
}

.section-heading h2 {
  max-width: 980px;
  margin: 0;
  color: #111827;
  font-size: clamp(1.55rem, 2.4vw, 2.45rem);
  line-height: 1.12;
}

.section-heading select,
.filters select,
.search-console input,
.newsletter-form input,
.newsletter-form select,
.auth-layout input,
.auth-layout select {
  border-color: rgba(198, 208, 222, 0.95);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
}

.mandate-dashboard,
.parliament-overview,
.agenda-groups,
.search-results,
.content-grid,
.timeline {
  margin-top: 22px;
}

.mandate-cards,
.parliament-metrics {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.mandate-cards article,
.parliament-metrics article,
.summary-panel div {
  min-height: 112px;
  display: grid;
  align-content: center;
}

.mandate-cards strong,
.parliament-metrics strong,
.metric {
  font-size: clamp(2rem, 3vw, 2.7rem);
}

.agenda-map-layout {
  grid-template-columns: minmax(420px, 1.6fr) minmax(300px, 0.8fr);
  align-items: stretch;
}

.map-panel,
.commune-panel,
.month-block,
.timeline-card,
.law-card,
.search-result,
.mandate-cards article,
.parliament-metrics article {
  border-color: rgba(198, 208, 222, 0.88);
  box-shadow: 0 14px 34px rgba(18, 27, 41, 0.08);
}

.map-panel,
.commune-panel {
  min-width: 0;
}

.haute-saone-map {
  min-height: clamp(360px, 42vw, 560px);
  background:
    linear-gradient(135deg, rgba(45, 111, 182, 0.06), rgba(178, 48, 61, 0.035)),
    #f8fafc;
}

.month-block h3,
.timeline-card h3,
.law-card h3,
.search-result h3 {
  color: #101827;
  font-size: clamp(1.02rem, 1.2vw, 1.24rem);
}

.event-row {
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr);
}

.event-row > div,
.timeline-card,
.law-card,
.search-result,
.commune-posts article {
  min-width: 0;
}

.event-row h4,
.event-row p,
.timeline-card h3,
.timeline-card p,
.law-card h3,
.law-card p,
.search-result h3,
.search-result p {
  overflow-wrap: anywhere;
}

.search-console {
  grid-template-columns: minmax(260px, 1fr);
  padding: 14px;
  background: rgba(248, 250, 253, 0.86);
  border: 1px solid rgba(198, 208, 222, 0.76);
  border-radius: 8px;
}

.search-filters {
  gap: 8px;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
}

.newsletter-form,
.support-form,
.auth-layout,
.profile-screen,
.legal-grid,
.parliament-overview,
.mandate-dashboard {
  max-width: 1180px;
}

@media (max-width: 1180px) {
  .agenda-map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .commune-panel {
    order: -1;
  }
}

@media (max-width: 760px) {
  body:not(.home-mode):not(.admin-mode) .workspace,
  body.home-mode .workspace {
    padding-inline: 12px;
    padding-top: 16px;
  }

  body.home-mode .tab-panel,
  body:not(.home-mode):not(.admin-mode) .tab-panel {
    grid-column: 1;
  }

  .tab-panel {
    padding: 16px;
    min-height: 0;
  }

  .section-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    min-height: 0;
  }

  .section-heading h2 {
    font-size: clamp(1.35rem, 8vw, 2rem);
  }

  .event-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .map-actions,
  .filters,
  .search-filters {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* Final admin-theme override: keep this block after all legacy responsive rules. */
body.admin-mode {
  background: #f5f7fb;
}

body.admin-mode .admin-shell {
  grid-template-columns: 206px minmax(0, 1fr);
  color: var(--admin-ink, #071a3d);
  background: #f5f7fb;
}

body.admin-mode .admin-sidebar {
  padding: 18px 14px;
  background: linear-gradient(180deg, #062b52 0%, #031d3d 58%, #021832 100%);
}

body.admin-mode .admin-sidebar nav .admin-nav-label {
  min-width: 0;
  width: auto;
  height: auto;
  display: block;
  overflow: hidden;
  color: inherit;
  background: transparent;
  border-radius: 0;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  place-items: initial;
}

body.admin-mode .admin-sidebar nav button {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 7px;
  min-height: 40px;
  padding: 8px 9px;
}

body.admin-mode .admin-sidebar nav .admin-nav-heading {
  min-height: 30px;
  grid-template-columns: minmax(0, 1fr) 14px;
  padding: 7px 8px 5px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

body.admin-mode .admin-sidebar nav .admin-nav-heading::before {
  display: none;
}

body.admin-mode .admin-sidebar nav .admin-nav-heading::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

body.admin-mode .admin-sidebar nav .admin-nav-group.is-collapsed .admin-nav-heading::after {
  transform: rotate(-45deg);
}

body.admin-mode .admin-sidebar nav .admin-nav-heading:hover,
body.admin-mode .admin-sidebar nav .admin-nav-heading:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

body.admin-mode .admin-sidebar nav .admin-nav-items {
  display: grid;
  gap: 4px;
}

body.admin-mode .admin-documents-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

body.admin-mode .admin-db-required {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
}

body.admin-mode .admin-db-required > div {
  width: min(620px, 100%);
  padding: 24px;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(31, 47, 76, 0.08);
}

body.admin-mode .admin-db-required h2 {
  margin: 0 0 10px;
  color: #101a3a;
  font-size: 1.45rem;
}

body.admin-mode .admin-db-required p {
  margin: 8px 0 0;
  color: #536987;
  font-weight: 760;
  line-height: 1.45;
}

@media (max-width: 980px) {
  body.admin-mode .admin-documents-grid {
    grid-template-columns: 1fr;
  }
}

body.admin-mode .local-dossiers-app {
  min-height: calc(100vh - 62px);
  padding: 18px 20px 24px;
  color: #142040;
  background: #f8fafc;
}

body.admin-mode .local-dossiers-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

body.admin-mode .local-dossiers-head h2,
body.admin-mode .local-dossiers-head p {
  margin: 0;
}

body.admin-mode .local-dossiers-head h2 {
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0;
}

body.admin-mode .local-dossiers-head p {
  margin-top: 6px;
  color: #587095;
  font-size: 0.9rem;
  font-weight: 760;
}

body.admin-mode .local-dossiers-actions,
body.admin-mode .local-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

body.admin-mode .local-dossiers-app svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.admin-mode .local-dossiers-actions button,
body.admin-mode .local-add-card,
body.admin-mode .local-table-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

body.admin-mode .local-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(160px, 210px)) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(31, 47, 76, 0.05);
}

body.admin-mode .local-filter-panel label,
body.admin-mode .local-detail-form label,
body.admin-mode .local-add-task,
body.admin-mode .local-add-document,
body.admin-mode .local-add-comment {
  color: #516684;
  font-size: 0.78rem;
  font-weight: 850;
}

body.admin-mode .local-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

body.admin-mode .local-kpi {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 7px;
  box-shadow: 0 10px 26px rgba(31, 47, 76, 0.045);
}

body.admin-mode .local-kpi > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

body.admin-mode .local-kpi strong {
  display: block;
  color: #101a3a;
  font-size: 1.45rem;
  line-height: 1;
}

body.admin-mode .local-kpi p,
body.admin-mode .local-kpi small {
  display: block;
  margin: 2px 0 0;
  overflow: hidden;
  color: #18294f;
  font-size: 0.77rem;
  font-weight: 860;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-mode .local-kpi small {
  color: #667994;
  font-size: 0.72rem;
  font-weight: 760;
}

body.admin-mode .local-kpi.tone-blue > span { color: #2563eb; background: #eaf1ff; }
body.admin-mode .local-kpi.tone-orange > span { color: #f97316; background: #fff0df; }
body.admin-mode .local-kpi.tone-green > span { color: #0f9f6e; background: #e7f8f0; }
body.admin-mode .local-kpi.tone-purple > span { color: #7c3aed; background: #f1e9ff; }
body.admin-mode .local-kpi.tone-slate > span { color: #64748b; background: #eef3f8; }

body.admin-mode .local-dossiers-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 16px;
  align-items: start;
}

body.admin-mode .local-dossiers-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

body.admin-mode .local-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(196px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

body.admin-mode .local-kanban-column {
  min-width: 196px;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 360px;
  padding: 10px;
  border: 1px solid #dfe7f2;
  border-radius: 7px;
}

body.admin-mode .local-kanban-column.tone-red { background: #fff6f7; border-left: 4px solid #f43f5e; }
body.admin-mode .local-kanban-column.tone-amber { background: #fff9ed; border-left: 4px solid #f59e0b; }
body.admin-mode .local-kanban-column.tone-blue { background: #f2f7ff; border-left: 4px solid #2563eb; }
body.admin-mode .local-kanban-column.tone-purple { background: #f8f3ff; border-left: 4px solid #8b5cf6; }
body.admin-mode .local-kanban-column.tone-green { background: #f1fbf6; border-left: 4px solid #10b981; }

body.admin-mode .local-kanban-column header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

body.admin-mode .local-kanban-column h3 {
  margin: 0;
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-mode .local-kanban-column header span {
  color: #273a62;
  font-size: 0.78rem;
  font-weight: 900;
}

body.admin-mode .local-kanban-column header button,
body.admin-mode .icon-action {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #587095;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

body.admin-mode .local-kanban-column header button:hover,
body.admin-mode .icon-action:hover {
  color: #175cd3;
  background: #eef4ff;
}

body.admin-mode .local-kanban-cards,
body.admin-mode .local-task-list,
body.admin-mode .local-document-list,
body.admin-mode .local-history-list {
  display: grid;
  gap: 8px;
}

body.admin-mode .local-dossier-card {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 12px;
  text-align: left;
  color: #15254b;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(31, 47, 76, 0.055);
}

body.admin-mode .local-dossier-card:hover,
body.admin-mode .local-dossier-card.is-active {
  border-color: #80a7f7;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 12px 26px rgba(31, 47, 76, 0.08);
}

body.admin-mode .local-dossier-card strong {
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  line-height: 1.25;
}

body.admin-mode .local-dossier-card span,
body.admin-mode .local-dossier-card time,
body.admin-mode .local-dossier-card small {
  color: #627694;
  font-size: 0.72rem;
  font-weight: 760;
}

body.admin-mode .local-dossier-card div,
body.admin-mode .local-dossier-card footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

body.admin-mode .local-avatar {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #2563eb;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 950;
}

body.admin-mode .local-status,
body.admin-mode .local-priority {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

body.admin-mode .local-status.status-new { color: #be123c; background: #ffe4ea; }
body.admin-mode .local-status.status-analysis { color: #b45309; background: #ffedd5; }
body.admin-mode .local-status.status-progress { color: #175cd3; background: #dbeafe; }
body.admin-mode .local-status.status-waiting { color: #7c3aed; background: #ede9fe; }
body.admin-mode .local-status.status-done { color: #047857; background: #d1fae5; }
body.admin-mode .local-status.status-archive { color: #475569; background: #e2e8f0; }
body.admin-mode .local-status.status-a-traiter { color: #175cd3; background: #dbeafe; }
body.admin-mode .local-status.status-termine { color: #047857; background: #d1fae5; }

body.admin-mode .local-priority.priority-urgente { color: #be123c; background: #ffe4ea; }
body.admin-mode .local-priority.priority-importante { color: #c2410c; background: #ffedd5; }
body.admin-mode .local-priority.priority-normale { color: #175cd3; background: #dbeafe; }

body.admin-mode .local-add-card {
  justify-self: start;
  margin-top: 2px;
  padding: 6px 2px;
  color: #3e5576;
  background: transparent;
  border: 0;
  font-size: 0.8rem;
  font-weight: 850;
}

body.admin-mode .local-detail-panel,
body.admin-mode .local-upcoming-tasks,
body.admin-mode .local-list-view {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 7px;
  box-shadow: 0 14px 32px rgba(31, 47, 76, 0.055);
}

body.admin-mode .local-dossier-detail {
  position: sticky;
  top: 78px;
  min-width: 0;
}

body.admin-mode .local-detail-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

body.admin-mode .local-detail-panel > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: start;
}

body.admin-mode .local-detail-panel > header span,
body.admin-mode .local-detail-panel > header p {
  color: #667994;
  font-size: 0.78rem;
  font-weight: 850;
}

body.admin-mode .local-detail-panel h3 {
  margin: 4px 0;
  overflow-wrap: anywhere;
  color: #101a3a;
  font-size: 1.05rem;
  line-height: 1.25;
}

body.admin-mode .local-citizen-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 7px;
}

body.admin-mode .local-citizen-card > em {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #175cd3;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 950;
}

body.admin-mode .local-citizen-card strong,
body.admin-mode .local-citizen-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.admin-mode .local-citizen-card span,
body.admin-mode .local-detail-description {
  color: #627694;
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.45;
}

body.admin-mode .local-detail-description {
  margin: 0;
}

body.admin-mode .local-detail-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #dbe4f0;
}

body.admin-mode .local-detail-tabs button {
  min-height: 38px;
  color: #4d6384;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 0.74rem;
  font-weight: 900;
}

body.admin-mode .local-detail-tabs button.is-active {
  color: #175cd3;
  border-bottom-color: #2563eb;
}

body.admin-mode .local-task-row,
body.admin-mode .local-document-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}

body.admin-mode .local-task-row label,
body.admin-mode .local-upcoming-tasks label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: #2b3b5e;
  font-size: 0.8rem;
  font-weight: 820;
}

body.admin-mode .local-task-row time {
  color: #627694;
  font-size: 0.72rem;
  font-weight: 780;
}

body.admin-mode .local-add-task,
body.admin-mode .local-add-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 160px) minmax(120px, 140px) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

body.admin-mode .local-add-comment {
  display: grid;
  gap: 8px;
}

body.admin-mode .local-detail-form {
  display: grid;
  gap: 12px;
}

body.admin-mode .local-detail-form textarea,
body.admin-mode .local-add-comment textarea {
  min-height: 100px;
}

body.admin-mode .local-document-list article div {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
}

body.admin-mode .local-document-list article span {
  grid-column: 2;
  color: #627694;
  font-size: 0.72rem;
  font-weight: 760;
}

body.admin-mode .local-history-list article {
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}

body.admin-mode .local-history-list strong,
body.admin-mode .local-history-list time {
  display: block;
}

body.admin-mode .local-history-list time {
  margin-top: 2px;
  color: #667994;
  font-size: 0.72rem;
  font-weight: 760;
}

body.admin-mode .local-history-list p {
  margin: 8px 0 0;
  color: #2b3b5e;
  font-size: 0.82rem;
  line-height: 1.45;
}

body.admin-mode .local-upcoming-tasks {
  padding: 14px;
  overflow-x: auto;
}

body.admin-mode .local-upcoming-tasks header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

body.admin-mode .local-upcoming-tasks h3 {
  margin: 0;
  font-size: 0.94rem;
}

body.admin-mode .local-list-view {
  overflow-x: auto;
}

body.admin-mode .local-upcoming-tasks table,
body.admin-mode .local-list-view table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

body.admin-mode .local-upcoming-tasks th,
body.admin-mode .local-upcoming-tasks td,
body.admin-mode .local-list-view th,
body.admin-mode .local-list-view td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  font-size: 0.78rem;
}

body.admin-mode .local-upcoming-tasks th,
body.admin-mode .local-list-view th {
  color: #536987;
  font-size: 0.72rem;
  font-weight: 900;
}

body.admin-mode .local-list-view tr[data-open-permanence] {
  cursor: pointer;
}

body.admin-mode .local-list-view tr[data-open-permanence]:hover {
  background: #f8fbff;
}

body.admin-mode .local-list-view td strong,
body.admin-mode .local-list-view td span {
  display: block;
}

body.admin-mode .local-list-view td span {
  margin-top: 3px;
  color: #667994;
  font-size: 0.72rem;
}

body.admin-mode .local-table-link {
  margin-top: 10px;
  color: #175cd3;
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 900;
}

@media (max-width: 1320px) {
  body.admin-mode .local-dossiers-layout {
    grid-template-columns: 1fr;
  }

  body.admin-mode .local-dossier-detail {
    position: static;
  }
}

@media (max-width: 980px) {
  body.admin-mode .local-dossiers-head,
  body.admin-mode .local-filter-panel {
    grid-template-columns: 1fr;
  }

  body.admin-mode .local-dossiers-actions {
    justify-content: stretch;
  }

  body.admin-mode .local-dossiers-actions button {
    flex: 1 1 160px;
  }

  body.admin-mode .local-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.admin-mode .local-add-task,
  body.admin-mode .local-add-document,
  body.admin-mode .local-citizen-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body.admin-mode .local-dossiers-app {
    padding: 14px 12px 20px;
  }

  body.admin-mode .local-kpi-grid,
  body.admin-mode .local-detail-tabs,
  body.admin-mode .local-detail-panel > header {
    grid-template-columns: 1fr;
  }
}

body.admin-mode .admin-sidebar nav .admin-nav-count {
  min-width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--admin-red, #e11d48);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

body.admin-mode .admin-workbench {
  padding: 0;
}

body.admin-mode .admin-topbar {
  position: sticky;
  grid-template-columns: 36px minmax(320px, 1fr) auto minmax(220px, auto);
  min-height: 62px;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--admin-line, #dbe3ef);
  box-shadow: 0 10px 24px rgba(13, 31, 61, 0.04);
}

body.admin-mode #admin-view {
  padding: 16px 14px 20px 20px;
}

body.admin-mode .admin-dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 394px;
  gap: 16px;
  align-items: start;
}

body.admin-mode .admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

body.admin-mode .admin-kpi-card,
body.admin-mode .admin-priority-card,
body.admin-mode .admin-task-overview,
body.admin-mode .selected-contact-card,
body.admin-mode .admin-panel,
body.admin-mode .admin-detail,
body.admin-mode .admin-form,
body.admin-mode .admin-filterbar,
body.admin-mode .admin-row,
body.admin-mode .activity-row {
  background: #fff;
  border: 1px solid var(--admin-line, #dbe3ef);
  border-radius: 7px;
  box-shadow: var(--admin-shadow, 0 14px 34px rgba(13, 31, 61, 0.08));
}

body.admin-mode .admin-kpi-card {
  min-height: 110px;
  display: flex;
  justify-content: space-between;
  padding: 18px;
  text-align: left;
}

body.admin-mode .admin-task-overview {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  overflow: hidden;
}

body.admin-mode .admin-task-lane {
  min-width: 0;
  border-right: 1px solid var(--admin-line, #dbe3ef);
}

body.admin-mode .dashboard-task-row {
  min-height: 58px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--admin-line, #dbe3ef);
  border-radius: 0;
  box-shadow: none;
}

body.admin-mode .admin-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
  gap: 14px;
}

body.admin-mode .admin-inspector {
  position: sticky;
  top: 78px;
}

body.admin-mode .selected-contact-card {
  min-height: calc(100vh - 150px);
  overflow: hidden;
}

body.admin-mode .primary-action {
  color: #fff;
  background: var(--admin-blue, #0b5bd3);
  border-color: var(--admin-blue, #0b5bd3);
}

body.admin-mode .admin-sync-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: #13643f;
  background: #e9f8ef;
  border: 1px solid #bee8cd;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

body.admin-mode .admin-sync-pill.sync-pending {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

body.admin-mode .admin-sync-pill.sync-error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

body.admin-mode .contact-admin-toolbar,
body.admin-mode .addons-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

body.admin-mode .contact-admin-toolbar h3,
body.admin-mode .contact-admin-toolbar p,
body.admin-mode .addons-head h3,
body.admin-mode .addons-head p {
  margin: 0;
}

body.admin-mode .admin-sync-note {
  display: block;
  margin-top: 6px;
  color: var(--admin-muted, #64728a);
  font-weight: 750;
}

body.admin-mode .contact-admin-actions,
body.admin-mode .data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

body.admin-mode .contact-quick-create {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
  box-shadow: none;
}

body.admin-mode .addons-admin,
body.admin-mode .admin-settings-grid {
  display: grid;
  gap: 14px;
}

body.admin-mode .plugin-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

body.admin-mode .plugin-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--admin-line, #dbe3ef);
  border-radius: 7px;
  box-shadow: var(--admin-shadow, 0 14px 34px rgba(13, 31, 61, 0.08));
}

body.admin-mode .plugin-toggle strong,
body.admin-mode .plugin-toggle small {
  display: block;
}

body.admin-mode .plugin-toggle small {
  margin-top: 4px;
  color: var(--admin-muted, #64728a);
}

body.admin-mode .plugin-toggle label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 850;
}

body.admin-mode .keyword-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid var(--admin-line, #dbe3ef);
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}

body.admin-mode .data-admin-tools textarea {
  min-height: 150px;
  margin-top: 12px;
}

@media (max-width: 1400px) {
  body.admin-mode .admin-dashboard-shell {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  body.admin-mode .admin-kpi-grid {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  body.admin-mode .admin-task-overview {
    overflow-x: auto;
  }

  body.admin-mode .admin-task-lane {
    min-width: 230px;
  }

  body.admin-mode .admin-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  body.admin-mode .admin-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  body.admin-mode .admin-dashboard-shell {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-inspector {
    position: static;
  }

  body.admin-mode .selected-contact-card {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body.admin-mode .admin-shell {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-topbar {
    position: static;
    grid-template-columns: 44px 1fr;
  }

  body.admin-mode .admin-topbar-actions,
  body.admin-mode .admin-user-chip {
    display: none;
  }

  body.admin-mode #admin-view {
    padding: 12px;
  }

  body.admin-mode .admin-kpi-grid,
  body.admin-mode .admin-bottom-grid,
  body.admin-mode .mail-composer-grid,
  body.admin-mode .selected-contact-body dl,
  body.admin-mode .selected-contact-card footer {
    grid-template-columns: 1fr;
  }

  body.admin-mode .admin-task-overview {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  body.admin-mode .admin-task-lane {
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--admin-line, #dbe3ef);
  }
}

/* Plugin Ma permanence */
.permanence-workspace {
  display: grid;
  gap: 14px;
}

.permanence-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.permanence-toolbar h3,
.permanence-toolbar p {
  margin: 0;
}

.permanence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.permanence-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  min-width: 210px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kanban-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-column h3 {
  margin: 0;
  font-size: 0.95rem;
}

.kanban-column header span,
.kanban-column header strong {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.kanban-column header span {
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
}

.kanban-column header strong {
  color: #fff;
  background: var(--red);
}

.kanban-cards {
  display: grid;
  gap: 8px;
}

.permanence-card {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 27, 41, 0.06);
}

.permanence-card span,
.permanence-card small,
.permanence-card em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.permanence-card strong {
  line-height: 1.2;
}

.permanence-card b {
  width: fit-content;
  padding: 3px 7px;
  color: #fff;
  font-size: 0.72rem;
  border-radius: 999px;
  background: var(--red);
}

.permanence-card.is-active {
  border-color: rgba(45, 111, 182, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 111, 182, 0.1);
}

.permanence-card.urgency-normal,
.status-chip.urgency-normal {
  border-left-color: var(--green);
}

.permanence-card.urgency-prioritaire,
.status-chip.urgency-prioritaire {
  border-left-color: var(--gold);
}

.permanence-card.urgency-critique,
.status-chip.urgency-critique {
  border-left-color: var(--red);
}

.status-chip.urgency-normal {
  background: var(--green);
}

.status-chip.urgency-prioritaire {
  background: var(--gold);
}

.status-chip.urgency-critique {
  background: var(--red);
}

.permanence-card.urgency-prioritaire {
  background: #fffaf0;
}

.permanence-card.urgency-critique {
  background: #fff4f5;
}

.permanence-card.has-ping {
  box-shadow: 0 0 0 3px rgba(178, 48, 61, 0.1), 0 10px 20px rgba(18, 27, 41, 0.08);
}

.permanence-detail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.permanence-subsection,
.contact-permanence-links,
.permanence-contact-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permanence-subsection h4,
.contact-permanence-links h4,
.permanence-contact-picker h4 {
  margin: 0;
}

.permanence-form .form-grid > label:has(select[name="contactId"]) {
  display: none;
}

.permanence-contact-results {
  max-height: 280px;
  display: grid;
  gap: 6px;
  overflow: auto;
}

.permanence-contact-results button {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permanence-contact-results button.is-selected {
  border-color: rgba(45, 111, 182, 0.45);
  background: #eef5ff;
}

.contact-preview-card {
  width: min(820px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.contact-profile-sheet {
  display: grid;
  gap: 12px;
}

.contact-profile-sheet h1,
.contact-profile-sheet h2 {
  margin: 0;
}

.contact-profile-sheet dl {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  gap: 8px 12px;
}

.contact-profile-sheet dt {
  color: var(--navy);
  font-weight: 900;
}

.contact-profile-sheet dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.attachment-list,
.attachment-preview-list,
.ping-list,
.contact-permanence-links {
  display: grid;
  gap: 8px;
}

.attachment-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.document-viewer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.document-viewer iframe {
  width: 100%;
  height: 420px;
  border: 0;
}

.document-viewer img {
  display: block;
  max-width: 100%;
  height: auto;
}

.document-fallback {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.document-workspace {
  display: grid;
  gap: 18px;
  color: #10224d;
}

.document-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.document-topbar h2 {
  margin: 0 0 5px;
  color: #081944;
  font-size: 1.45rem;
}

.document-topbar p {
  margin: 0;
  color: #5f6d86;
  font-weight: 700;
}

.document-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.document-topbar svg,
.document-workspace button svg,
.document-info-card svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: 720px;
}

.document-tree-panel,
.document-preview-card,
.document-info-card,
.document-inline-form {
  background: #fff;
  border: 1px solid #dfe7f5;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(35, 50, 82, 0.06);
}

.document-tree-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.document-tree-head,
.document-storage-card div,
.document-storage-card p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.document-tree-head h3,
.document-mini-list h4,
.document-info-card h3,
.document-info-card h4 {
  margin: 0;
  color: #0a1d4a;
  font-size: 0.95rem;
}

.document-tree-head div {
  display: flex;
  gap: 6px;
}

.document-tree-head button,
.document-associated-files button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #2865d8;
  background: #fff;
  border: 1px solid #dce6f6;
  border-radius: 6px;
}

.document-tree,
.document-tree-branch,
.document-mini-list,
.document-associated-files,
.document-side-actions {
  display: grid;
  gap: 7px;
}

.document-tree-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  margin-left: calc(var(--depth, 0) * 14px);
  color: #314064;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.document-tree-row.is-active,
.document-mini-list button.is-active {
  color: #095bd8;
  background: #edf4ff;
}

.document-tree-row strong,
.document-mini-list strong {
  overflow: hidden;
  font-size: 0.82rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-tree-row em {
  padding: 2px 7px;
  color: #62728f;
  background: #f2f5fa;
  border-radius: 999px;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.document-mini-list {
  padding-top: 10px;
  border-top: 1px solid #edf1f8;
}

.document-mini-list button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 8px;
  align-items: center;
  padding: 8px;
  text-align: left;
  background: #fff;
  border: 1px solid #edf1f8;
  border-radius: 7px;
}

.document-mini-list small {
  grid-column: 2;
  overflow: hidden;
  color: #697894;
  font-size: 0.72rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-storage-card {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  background: #fbfcff;
  border: 1px solid #e1e8f5;
  border-radius: 8px;
}

.document-storage-card div,
.document-storage-card p {
  margin: 0;
  color: #5f6d86;
  font-size: 0.78rem;
}

.document-storage-card strong {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #10224d;
}

.document-storage-card i {
  height: 7px;
  overflow: hidden;
  background: #e7eef9;
  border-radius: 999px;
}

.document-storage-card i::before {
  content: "";
  display: block;
  width: var(--storage, 0%);
  height: 100%;
  background: #1260d8;
}

.document-storage-card em {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 6px;
  background: #1faa6c;
  border-radius: 999px;
}

.document-preview-card {
  min-height: 720px;
  overflow: hidden;
}

.document-preview-card > header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #e6edf7;
}

.document-preview-title {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.document-preview-title h3 {
  margin: 0 0 3px;
  overflow: hidden;
  color: #10224d;
  font-size: 1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-preview-title p {
  margin: 0;
  color: #687892;
  font-size: 0.78rem;
  font-weight: 700;
}

.document-preview-title mark {
  padding: 5px 9px;
  color: #14854d;
  background: #def6e8;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.document-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.document-viewer-toolbar {
  height: 52px;
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  color: #53637f;
  background: #f5f7fb;
  border-bottom: 1px solid #e5ebf5;
}

.document-viewer-toolbar span,
.document-viewer-toolbar strong,
.document-viewer-toolbar button {
  min-width: 42px;
  min-height: 28px;
  display: grid;
  place-items: center;
  padding: 0 9px;
  background: #fff;
  border: 1px solid #e0e7f2;
  border-radius: 6px;
  font-size: 0.78rem;
}

.document-viewer-toolbar i {
  display: grid;
  place-items: center;
}

.document-pdf-stage {
  min-height: 640px;
  display: grid;
  place-items: center;
  padding: 26px;
  background: #eef2f8;
}

.document-pdf-stage iframe {
  width: min(100%, 760px);
  height: 610px;
  background: #fff;
  border: 0;
  box-shadow: 0 22px 55px rgba(30, 44, 73, 0.2);
}

.document-pdf-empty,
.document-empty > div {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 420px;
  color: #667693;
  text-align: center;
}

.document-pdf-empty svg,
.document-empty svg {
  width: 42px;
  height: 42px;
}

.document-info-card {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
}

.document-info-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0;
}

.document-info-card dl div:first-child,
.document-info-card dl div:nth-child(2),
.document-info-card dl div:nth-child(3) {
  grid-column: 1 / -1;
}

.document-info-card dt {
  margin-bottom: 4px;
  color: #65738d;
  font-size: 0.72rem;
  font-weight: 900;
}

.document-info-card dd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: #223456;
  font-size: 0.82rem;
  font-weight: 800;
}

.document-file-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  color: #fff;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 900;
}

.document-file-badge.pdf {
  background: #ef3440;
}

.document-file-badge.word {
  background: #1260d8;
}

.document-associated-files article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fbfcff;
  border: 1px solid #e3ebf8;
  border-radius: 8px;
}

.document-associated-files strong,
.document-associated-files small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-associated-files strong {
  color: #27395d;
  font-size: 0.78rem;
}

.document-associated-files small {
  color: #6b7890;
  font-size: 0.72rem;
}

.document-side-actions button,
.document-side-actions label {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  color: #1260d8;
  background: #fff;
  border: 1px solid #dce6f6;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.document-side-actions label input {
  display: none;
}

.document-side-actions .danger {
  justify-content: center;
  color: #d92736;
  background: #fff;
  border-color: #ffc7ce;
}

.document-inline-form,
.document-edit-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.document-inline-form {
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
}

.document-inline-form h3 {
  margin: 0;
  color: #0b1c47;
}

.document-inline-form > label,
.document-inline-form > .form-grid,
.document-inline-form > .form-actions {
  min-width: 0;
}

.document-inline-form textarea {
  min-height: 42px;
}

.document-inline-form label small {
  display: block;
  margin-top: 5px;
  color: #697894;
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .document-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .document-info-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .document-topbar,
  .document-preview-card > header {
    display: grid;
  }

  .document-layout,
  .document-inline-form {
    grid-template-columns: 1fr;
  }

  .document-pdf-stage iframe {
    height: 520px;
  }
}

.ping-list article {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ping-list article.is-mine {
  border-color: rgba(178, 48, 61, 0.3);
  background: #fff7f8;
}

.linked-contact-panel button,
.contact-permanence-links button {
  width: 100%;
  padding: 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .permanence-layout {
    grid-template-columns: 1fr;
  }

  .permanence-detail {
    position: static;
  }
}

body.admin-mode {
  background: #eef2f7;
}

body.admin-mode .site-header,
body.admin-mode .hero,
body.admin-mode .summary-panel,
body.admin-mode footer {
  display: none;
}

body:not(.home-mode):not(.admin-mode) .hero,
body:not(.home-mode):not(.admin-mode) .summary-panel {
  display: none;
}

body.admin-mode main,
body.admin-mode .workspace {
  display: block;
  padding: 0;
  max-width: none;
}

#panel-admin > :not(.admin-shell) {
  display: none;
}

body.admin-mode #panel-admin {
  display: block;
  padding: 0;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  color: #162033;
  background: #eef2f7;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: #132b4d;
  color: #fff;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.admin-brand small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.admin-sidebar nav {
  display: grid;
  gap: 5px;
  overflow: auto;
}

.admin-sidebar nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.admin-sidebar nav button.is-active,
.admin-sidebar nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.admin-sidebar nav span,
.admin-notification-pill {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-sidebar #leave-admin {
  margin-top: auto;
  color: #132b4d;
  background: #fff;
}

.admin-workbench {
  min-width: 0;
  padding: 22px clamp(18px, 3vw, 36px) 40px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 480px) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0 18px;
  background: rgba(238, 242, 247, 0.92);
  backdrop-filter: blur(16px);
}

.admin-topbar h2,
.admin-topbar p,
.admin-metric p,
.admin-panel h3,
.admin-row p,
.activity-row p {
  margin: 0;
}

.admin-topbar h2 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.admin-topbar p,
.admin-help {
  color: var(--muted);
}

.admin-global-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.admin-metric,
.admin-panel,
.admin-row,
.activity-row,
.admin-form,
.admin-filterbar,
.admin-detail {
  background: #fff;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(18, 27, 41, 0.06);
}

.admin-metric {
  min-height: 104px;
  padding: 18px;
  text-align: left;
}

.admin-metric span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  color: var(--navy);
}

.admin-dashboard-grid,
.admin-search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.admin-panel,
.admin-detail,
.admin-form {
  padding: 16px;
}

.admin-panel h3 {
  margin-bottom: 12px;
}

.admin-panel button,
.admin-list button {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px;
  margin-top: 8px;
  color: inherit;
  text-align: left;
  background: #f7f9fc;
  border: 1px solid #e2e8f1;
  border-radius: 7px;
}

.admin-panel button span,
.admin-list button span,
.admin-list button em,
.admin-row p,
.activity-row span,
.activity-row time {
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-filterbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.admin-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.admin-list button.is-active {
  background: #eaf1fb;
  border-color: rgba(45, 111, 182, 0.45);
}

.admin-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-history {
  padding: 12px;
  margin: 12px 0;
  background: #f7f9fc;
  border-radius: 7px;
}

.admin-history p,
.admin-comments p {
  margin: 6px 0;
}

.admin-create-panel {
  margin-bottom: 14px;
}

.admin-create-panel summary {
  cursor: pointer;
  font-weight: 900;
}

.admin-comments {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 12px 0;
  background: #f7f9fc;
  border-radius: 7px;
}

.admin-comments h4 {
  margin: 0;
}

.admin-comments article {
  padding: 10px;
  background: #fff;
  border: 1px solid #e2e8f1;
  border-radius: 7px;
}

.admin-comments time {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.public-content-admin .admin-table h3 {
  margin: 0 0 8px;
}

.admin-config-form textarea {
  min-height: 150px;
}

.parliament-admin {
  display: grid;
  gap: 14px;
}

.parliament-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 12px;
}

.parliament-create-card,
.parliament-add-column {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.5fr) minmax(140px, 0.5fr) auto;
  gap: 8px;
}

.parliament-add-column {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.parliament-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 320px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.parliament-column {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: 72vh;
  background: #f7f9fc;
  border: 1px solid #dce3ee;
  border-radius: 8px;
}

.parliament-column header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e2e8f1;
}

.parliament-column h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: capitalize;
}

.parliament-column header span {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--navy);
  background: #fff;
  border: 1px solid #dce3ee;
  border-radius: 999px;
  font-weight: 900;
}

.icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 1px solid #dce3ee;
  border-radius: 6px;
  background: #fff;
}

.parliament-card-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 340px;
  padding: 12px;
  overflow-y: auto;
}

.parliament-card {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 12px 12px 16px;
  color: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #dce3ee;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(18, 27, 41, 0.06);
}

.parliament-card.is-selected {
  border-color: rgba(45, 111, 182, 0.52);
  box-shadow: var(--focus);
}

.parliament-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.parliament-card small {
  color: var(--muted);
}

.parliament-card.type-amendement {
  border-left-color: #2d6fb6;
}

.parliament-card.type-proposition-de-loi {
  border-left-color: #2f765f;
}

.parliament-card.type-question-ecrite,
.parliament-card.type-question-orale {
  border-left-color: #b98a3b;
}

.parliament-card.type-intervention-en-seance {
  border-left-color: #7b61b5;
}

.parliament-card.type-courrier-ministeriel {
  border-left-color: #b2303d;
}

.parliament-detail-panel {
  max-width: 1180px;
}

.parliament-description-field {
  margin-top: 10px;
}

.parliament-description {
  min-height: 280px;
  line-height: 1.55;
}

.parliament-empty-detail {
  max-width: 720px;
}

.status-chip {
  align-self: start;
  padding: 7px 10px;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
}

.status-chip.urgente,
.danger {
  background: var(--red);
  color: #fff;
}

.contacts-admin {
  display: grid;
  gap: 14px;
}

.contact-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-tabs button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--navy);
  font-weight: 850;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.contact-io-hero h2,
.contact-io-hero p {
  margin: 0;
}

.contact-io-hero h2 {
  color: var(--navy);
  font-size: 1.45rem;
}

.contact-io-hero p {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 700;
}

.contact-io-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-io-tabs button {
  min-height: 52px;
  color: var(--navy);
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  font-weight: 900;
}

.contact-io-tabs button:last-child {
  border-right: 0;
}

.contact-io-tabs button.is-active {
  color: var(--blue);
  background: #f7fbff;
  box-shadow: inset 0 0 0 1px #9fc5ff;
}

.contact-io-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(230px, 1fr) minmax(300px, 1.25fr);
  gap: 14px;
}

.contact-io-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(18, 27, 41, 0.06);
}

.contact-io-card h3,
.contact-io-card p {
  margin: 0;
}

.contact-io-card h3 {
  color: var(--navy);
}

.contact-io-card p,
.contact-io-card small {
  color: var(--muted);
  font-weight: 700;
}

.contact-dropzone {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  border: 1px dashed #b8c9df;
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}

.contact-dropzone span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--blue);
  border: 3px solid var(--blue);
  border-radius: 999px;
  font-size: 2rem;
  line-height: 1;
}

.contact-dropzone b {
  padding: 9px 16px;
  color: var(--blue);
  background: #fff;
  border: 1px solid #b8c9df;
  border-radius: 6px;
}

.contact-dropzone input,
.contact-json-import input {
  display: none;
}

.contact-io-options,
.contact-io-choice {
  display: grid;
  gap: 6px;
}

.contact-io-options label,
.contact-io-choice label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  font-weight: 900;
}

.contact-create-card {
  display: grid;
  gap: 14px;
}

.contact-create-avatar {
  width: 78px;
  height: 78px;
  margin: 0 auto;
  border-radius: 999px;
  background: radial-gradient(circle at center, var(--navy) 0 9px, #e6ebf3 10px);
}

.contact-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contact-create-grid label:nth-child(6),
.contact-create-grid label:nth-child(9),
.contact-create-grid label:nth-child(10),
.contact-create-grid label:nth-child(11) {
  grid-column: 1 / -1;
}

.contact-search-panel,
.contact-import-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(18, 27, 41, 0.06);
}

.contact-search-head {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
}

.contact-search-head h3,
.contact-search-head p {
  margin: 0;
}

.contact-search-primary-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(360px, 1fr) auto;
  gap: 8px;
  justify-content: start;
  align-items: center;
}

.contact-search-primary-actions > input,
.contact-search-primary-actions > button,
.contact-search-primary-actions > .contact-pagination-controls {
  align-self: end;
}

.contact-dynamic-search {
  grid-column: 1 / -1;
}

.contact-filter-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.contact-filter-section summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.contact-filter-section summary::-webkit-details-marker {
  display: none;
}

.contact-filter-section summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.contact-filter-section[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.contact-filter-section[open] summary::after {
  content: "-";
}

.contact-filter-section > fieldset,
.contact-filter-section > .contact-filter-grid,
.contact-filter-section > .contact-age-filter,
.contact-filter-section > .contact-pagination-controls,
.contact-filter-section > .data-actions {
  margin: 12px;
}

.contact-dynamic-search .contact-filter-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.contact-dynamic-search label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.contact-dynamic-search input,
.contact-dynamic-search select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(198, 208, 222, 0.95);
  border-radius: 6px;
}

.contact-age-filter {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-age-filter > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-age-filter strong {
  color: var(--navy);
}

.contact-age-filter span {
  color: var(--muted);
  font-weight: 850;
}

.contact-age-range {
  position: relative;
  min-height: 34px;
  display: grid;
  align-items: center;
}

.contact-age-range::before {
  content: "";
  position: absolute;
  right: 6px;
  left: 6px;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px calc(100% / 12)), linear-gradient(90deg, #edf2f7, #e8eef7);
  border-radius: 999px;
}

.contact-age-range input[type="range"] {
  position: relative;
  grid-area: 1 / 1;
  width: 100%;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  pointer-events: none;
  appearance: none;
}

.contact-age-range input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  background: var(--red);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(18, 27, 41, 0.2);
  pointer-events: auto;
  appearance: none;
}

.contact-age-range input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--red);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(18, 27, 41, 0.2);
  pointer-events: auto;
}

.contact-age-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.contact-filter-grid,
.contact-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.contact-filter-grid label,
.contact-form-grid label {
  min-width: 0;
}

.contact-form-grid label:has(textarea) {
  grid-column: span 2;
}

.contact-split {
  margin-top: 14px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
}

.contact-pagination-controls,
.contact-keyword-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.contact-pagination-controls label {
  min-width: 180px;
}

.contact-pagination-controls button {
  width: auto;
  margin-top: 0;
}

.contact-selection-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 27, 41, 0.06);
}

.contact-selection-toolbar button {
  width: auto;
  margin-top: 0;
}

.contact-selection-toolbar small {
  color: var(--muted);
  font-weight: 800;
}

.contact-delete-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  box-shadow: 0 12px 24px rgba(127, 29, 29, 0.12);
}

.contact-delete-progress h3,
.contact-delete-progress p {
  margin: 0;
}

.contact-delete-progress h3 {
  color: var(--navy);
}

.contact-delete-progress p {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.contact-delete-ring {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--red) var(--progress, 0deg), #fee2e2 0deg);
}

.contact-delete-ring::before {
  content: "";
  grid-area: 1 / 1;
  width: 42px;
  height: 42px;
  border-radius: inherit;
  background: #fff;
}

.contact-delete-ring span {
  position: relative;
  grid-area: 1 / 1;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
}

.contact-result-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-result-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.contact-result-row button {
  width: 100%;
  margin-top: 0;
}

.contact-result-row.is-active button {
  border-color: var(--red);
  background: #fff8f8;
}

.contact-result-row > .danger {
  width: auto;
}

.contact-result-check {
  display: grid;
  place-items: center;
  min-height: 42px;
}

.contact-sticky-detail {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.contact-deceased-label {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 3px 8px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  background: #343a46;
  border-radius: 999px;
}

.contact-support-label {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 3px 8px;
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 900;
  background: #eef4fb;
  border: 1px solid rgba(45, 111, 182, 0.18);
  border-radius: 999px;
}

.contact-result-row.is-opponent {
  background: linear-gradient(90deg, rgba(178, 48, 61, 0.095), rgba(255, 255, 255, 0.96) 58%);
  border-color: rgba(178, 48, 61, 0.22);
}

.contact-result-row.is-opponent .contact-result-main > button {
  background: rgba(255, 248, 248, 0.92);
  border-color: rgba(178, 48, 61, 0.2);
}

.contact-result-row.is-opponent .contact-support-label {
  color: #8e2330;
  background: #fff0f1;
  border-color: rgba(178, 48, 61, 0.22);
}

.contact-result-row.is-supporter {
  background: linear-gradient(90deg, rgba(45, 111, 182, 0.095), rgba(255, 255, 255, 0.96) 58%);
  border-color: rgba(45, 111, 182, 0.22);
}

.contact-result-row.is-supporter .contact-result-main > button {
  background: rgba(244, 248, 253, 0.94);
  border-color: rgba(45, 111, 182, 0.2);
}

.contact-result-row.is-supporter .contact-support-label {
  color: var(--navy);
  background: #eef5ff;
  border-color: rgba(45, 111, 182, 0.24);
}

.contact-support-gauge {
  display: grid;
  gap: 10px;
}

.support-gauge-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.support-gauge-options label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.support-gauge-options label.is-effective {
  border-color: rgba(45, 111, 182, 0.35);
  box-shadow: 0 8px 18px rgba(18, 27, 41, 0.07);
}

.contact-deceased-toggle {
  align-self: center;
  color: var(--muted);
  font-weight: 850;
}

.contact-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.death-chip {
  background: #343a46;
  border-color: #343a46;
}

.contact-death-button {
  color: #fff;
  background: #343a46;
  border-color: #343a46;
}

.contact-plugin-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 27, 41, 0.42);
}

.contact-plugin-modal {
  width: min(460px, 100%);
  box-shadow: var(--shadow);
}

.task-center,
.team-center,
.template-studio {
  display: grid;
  gap: 14px;
}

.task-command-panel,
.template-studio-head,
.team-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.task-command-panel h3,
.task-command-panel p,
.template-studio-head h3,
.template-studio-head p,
.team-overview h3,
.team-overview p {
  margin: 0;
}

.task-quick-create {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 130px minmax(180px, 220px) 150px auto;
  gap: 8px;
  align-items: end;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.task-column {
  min-width: 220px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #dce3ee;
  border-radius: 8px;
}

.task-column header,
.team-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.task-column h3,
.team-card p {
  margin: 0;
}

.task-card {
  padding: 12px;
  background: #fff;
  border: 1px solid #dce3ee;
  border-left: 4px solid #7a8798;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 27, 41, 0.05);
}

.task-card.priority-urgente,
.task-card.is-late {
  border-left-color: var(--red);
}

.task-card.priority-importante {
  border-left-color: #d88c1f;
}

.task-card form,
.task-card-list,
.task-checklist,
.team-next {
  display: grid;
  gap: 8px;
}

.task-card-head,
.task-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.task-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-checklist label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.team-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(18, 27, 41, 0.06);
}

.team-card header span {
  padding: 6px 9px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  background: #eef4fb;
  border-radius: 999px;
}

.team-load,
.team-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.team-load div {
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f1;
  border-radius: 8px;
}

.team-load strong {
  display: block;
  color: var(--navy);
  font-size: 1.4rem;
}

.template-studio-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(360px, 1fr) minmax(300px, 0.48fr);
  gap: 14px;
  align-items: start;
}

.template-list,
.template-row form,
.template-editor,
.template-context-form,
.linked-task-list {
  display: grid;
  gap: 12px;
}

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

.template-preview {
  position: sticky;
  top: 92px;
}

.generated-template-preview {
  padding: 16px;
  background: #fff;
  border: 1px solid #dce3ee;
  border-radius: 8px;
}

.generated-template-preview span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.generated-template-preview h4 {
  margin: 8px 0 12px;
  color: var(--navy);
}

.template-context-form {
  margin-bottom: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f1;
  border-radius: 8px;
}

.permanence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.55fr);
  gap: 14px;
  align-items: start;
}

.permanence-detail {
  position: sticky;
  top: 92px;
}

.permanence-card.is-active {
  border-color: var(--red);
  background: #fff8f8;
}

.linked-task-list {
  padding: 12px;
  margin: 12px 0;
  background: #f8fafc;
  border: 1px solid #e2e8f1;
  border-radius: 8px;
}

.linked-task-list h4 {
  margin: 0;
}

.map-fallback {
  position: relative;
  min-height: 360px;
  transform-origin: center;
  background:
    linear-gradient(135deg, rgba(45, 111, 182, 0.13), rgba(178, 48, 61, 0.09)),
    #f8fafc;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  overflow: hidden;
}

.map-pin {
  position: absolute;
  min-height: 30px;
  padding: 6px 9px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--red);
  border: 2px solid #fff;
  border-radius: 999px 999px 999px 4px;
  box-shadow: 0 8px 18px rgba(18, 27, 41, 0.22);
  transform: rotate(-12deg);
}

.map-pin.is-active {
  background: var(--navy);
}

.death-admin {
  display: grid;
  gap: 14px;
}

.death-toolbar,
.death-layout,
.death-detail-grid {
  display: grid;
  gap: 14px;
}

.death-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.death-toolbar h3,
.death-toolbar p {
  margin: 0;
}

.death-layout {
  grid-template-columns: minmax(280px, 0.38fr) minmax(0, 1fr);
  align-items: start;
}

.death-case-column,
.death-case-list,
.death-relative-list,
.death-contact-picker {
  display: grid;
  gap: 10px;
}

.death-case-list button,
.death-contact-results button {
  width: 100%;
  text-align: left;
}

.death-case-list button.is-active,
.death-contact-results button.is-selected {
  border-color: var(--red);
  background: #fff8f8;
}

.death-contact-results {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.death-contact-results button span,
.death-case-list button span,
.death-relative-row p {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.contact-search-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.contact-search-picker > label,
.contact-search-picker input[type="search"] {
  width: 100%;
}

.contact-picker-label {
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 850;
}

.contact-picker-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.contact-picker-field-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.contact-picker-selected {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.contact-picker-card {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.contact-picker-card.is-deceased,
.death-contact-results button.is-deceased {
  opacity: 0.55;
  filter: grayscale(1);
}

.death-contact-results button.is-deceased {
  background: #f1f3f5;
  color: #697386;
}

.contact-picker-card strong {
  color: var(--navy);
}

.contact-picker-card span {
  color: var(--muted);
}

.contact-picker-results button strong {
  display: block;
}

.contact-search-picker small {
  color: var(--muted);
  font-weight: 700;
}

.death-relative-add {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(150px, 210px) minmax(150px, 210px) auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.death-relative-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.death-template-panel textarea {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.death-admin {
  color: #12214a;
}

.death-hero,
.death-case-header,
.death-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.death-hero h2,
.death-case-header h2,
.death-table-card h3,
.death-section-head h3,
.death-side h3,
.death-template-studio h3 {
  margin: 0;
  color: #061947;
}

.death-hero p,
.death-case-header p,
.death-section-head p {
  margin: 6px 0 0;
  color: #52648f;
  font-weight: 700;
}

.death-searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto auto;
  gap: 16px;
  align-items: end;
  margin: 20px 0;
}

.death-searchbar input,
.death-searchbar select {
  min-height: 46px;
  border: 1px solid #dbe4f3;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 750;
}

.death-searchbar label {
  display: grid;
  gap: 6px;
  color: #334773;
  font-size: 0.82rem;
  font-weight: 900;
}

.death-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.death-pagination-controls span,
.death-table-head span {
  color: #52648f;
  font-weight: 850;
  font-size: 0.88rem;
}

.death-pagination-controls button {
  width: auto;
  margin-top: 0;
}

.death-create-panel,
.death-relative-add {
  display: none;
}

.death-create-panel.is-open,
.death-relative-add.is-open {
  display: block;
  margin-bottom: 18px;
}

.death-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.death-kpis article {
  display: grid;
  grid-template-columns: 52px auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  padding: 18px;
}

.death-kpis strong {
  font-size: 1.55rem;
  color: #061947;
}

.death-kpis p {
  margin: 0;
  color: #23396b;
  font-weight: 850;
}

.death-kpis small {
  color: #65779f;
}

.death-kpi-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
}

.death-kpi-icon svg {
  width: 20px;
  height: 20px;
}

.death-kpi-icon.blue { background: #e8f1ff; color: #1260d8; }
.death-kpi-icon.green { background: #ddf6e8; color: #159257; }
.death-kpi-icon.orange { background: #fff0df; color: #f07a22; }
.death-kpi-icon.purple { background: #f2e4ff; color: #9a3bd4; }

.death-table-card,
.death-template-studio,
.death-edit-panel,
.death-side section {
  background: #fff;
  border: 1px solid #dfe7f4;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(25, 48, 92, 0.06);
}

.death-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.death-table-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.death-table th,
.death-table td {
  padding: 14px 8px;
  border-bottom: 1px solid #e2e9f4;
  text-align: left;
  vertical-align: middle;
}

.death-table th {
  color: #334773;
  font-size: 0.82rem;
}

.death-count-pill,
.death-relation-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eaf2ff;
  color: #1260d8;
  font-weight: 900;
  font-size: 0.78rem;
}

.death-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  color: #52648f;
}

.death-breadcrumb button,
.death-side button {
  border: 0;
  background: transparent;
  color: #1260d8;
  font-weight: 900;
  cursor: pointer;
}

.death-case-header h2 span {
  display: inline-flex;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eaf2ff;
  color: #1260d8;
  font-size: 0.78rem;
  vertical-align: middle;
}

.death-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}

.death-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid #dfe7f4;
  margin: 18px 0 20px;
}

.death-tabs button {
  padding: 0 0 13px;
  border: 0;
  background: transparent;
  color: #334773;
  font-weight: 900;
}

.death-tabs button.is-active {
  color: #1260d8;
  border-bottom: 3px solid #1260d8;
}

.death-recipient {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
}

.death-recipient span {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e9f1ff;
  color: #1260d8;
  font-weight: 900;
}

.death-recipient small {
  color: #52648f;
  font-weight: 750;
}

.death-response {
  display: inline-flex;
  border-radius: 7px;
  padding: 8px 11px;
  font-weight: 900;
  font-size: 0.82rem;
}

.death-response.answered { background: #def6e8; color: #14854d; }
.death-response.pending { background: #fff0df; color: #d2631b; }
.death-response.none { background: #eef1f6; color: #516075; }

.death-info-note {
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid #cfe0ff;
  border-radius: 7px;
  color: #3f5480;
  background: #f7fbff;
  font-weight: 750;
}

.death-side {
  display: grid;
  gap: 14px;
}

.death-side dl,
.death-side p {
  margin: 14px 0 0;
}

.death-side dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}

.death-side dt {
  color: #334773;
  font-weight: 900;
}

.death-side dd {
  margin: 0;
  color: #52648f;
  text-align: right;
}

.death-side .danger {
  color: #ff3857;
}

.death-template-studio {
  margin-top: 22px;
}

.death-template-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
}

.death-template-list {
  display: grid;
  gap: 16px;
}

.death-template-form,
.rich-editor {
  display: grid;
  gap: 10px;
}

.death-variable-table {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.death-variable-head,
.death-variable-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(170px, 1fr) minmax(130px, 0.8fr) minmax(180px, 1.1fr) 42px;
  gap: 8px;
  align-items: stretch;
}

.death-variable-head {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.death-variable-head::after {
  content: "";
}

.death-variable-row input,
.death-variable-row select,
.death-variable-row textarea {
  min-width: 0;
  width: 100%;
}

.death-variable-row textarea {
  min-height: 58px;
  resize: vertical;
}

.word-variable-add {
  justify-self: start;
}

.death-options-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #dce6f6;
  border-radius: 8px;
  background: #fff;
}

.death-relation-create,
.death-relation-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.death-relation-list {
  display: grid;
  gap: 10px;
}

.death-relation-row {
  align-items: center;
  padding: 10px;
  border: 1px solid #e3ebf7;
  border-radius: 8px;
  background: #f8fbff;
}

.death-template-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe4f3;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f8fbff;
}

.rich-toolbar button,
.rich-toolbar select {
  min-height: 32px;
  border: 1px solid #d7e2f2;
  border-radius: 6px;
  background: #fff;
  color: #1b2e5d;
  font-weight: 850;
}

.rich-surface {
  min-height: 260px;
  padding: 16px;
  border: 1px solid #dbe4f3;
  border-radius: 0 0 8px 8px;
  background: #fff;
  color: #10204a;
  line-height: 1.55;
  outline: none;
}

.rich-surface:focus {
  border-color: #1260d8;
  box-shadow: 0 0 0 3px rgba(18, 96, 216, 0.12);
}

@media (max-width: 980px) {
  .death-kpis,
  .death-page-grid,
  .death-template-grid,
  .death-variable-head,
  .death-variable-row,
  .death-relation-create,
  .death-relation-row {
    grid-template-columns: 1fr;
  }

  .death-hero,
  .death-case-header,
  .death-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .death-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .death-searchbar,
  .death-kpis article {
    grid-template-columns: 1fr;
  }

  .death-tabs,
  .rich-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .contact-picker-field-grid {
    grid-template-columns: 1fr;
  }

  .death-recipient-table .form-actions {
    min-width: 520px;
  }
}

.death-template-studio .rich-editor {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.death-template-studio .rich-surface {
  min-height: 260px;
  padding: 16px;
  border: 1px solid #dbe4f3;
  border-radius: 0 0 8px 8px;
  background: #fff;
}

.word-template-manager {
  display: grid;
  gap: 24px;
  color: #11204a;
}

.word-template-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.word-template-hero h2 {
  margin: 0 0 6px;
  color: #111a44;
  font-size: 1.72rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.word-template-hero p {
  margin: 0;
  color: #53658f;
  font-weight: 700;
}

.word-template-add {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-inline: 18px;
  border-radius: 6px;
  background: #075ee8;
  box-shadow: 0 10px 22px rgba(7, 94, 232, 0.22);
  white-space: nowrap;
}

.word-template-add svg,
.word-filter svg,
.word-search svg,
.icon-action svg,
.word-template-avatar svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.word-template-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
}

.word-search {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(100%, 440px);
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #d8e3f4;
  border-radius: 6px;
  background: #fff;
  color: #7d8bac;
  box-shadow: 0 1px 2px rgba(18, 27, 41, 0.03);
}

.word-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #17224c;
  font-weight: 700;
}

.word-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding-inline: 22px;
  border-radius: 6px;
  color: #172b5f;
}

.word-template-table-card,
.word-template-form {
  border: 1px solid #dce6f6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(18, 27, 41, 0.04);
}

.word-template-table-card {
  overflow: hidden;
}

.word-template-table-card > h3 {
  margin: 0;
  padding: 22px 24px 14px;
  color: #17204b;
  font-size: 1.08rem;
}

.word-template-table {
  display: grid;
}

.word-template-table-head,
.word-template-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(230px, 1.35fr) minmax(120px, 0.7fr) minmax(190px, 1fr) 112px;
  gap: 18px;
  align-items: center;
}

.word-template-table-head {
  padding: 14px 24px;
  border-bottom: 1px solid #e4ebf6;
  color: #41517c;
  font-size: 0.78rem;
  font-weight: 900;
}

.word-template-row-wrap {
  border-bottom: 1px solid #e7eef8;
}

.word-template-row-wrap:last-child {
  border-bottom: 0;
}

.word-template-row {
  min-height: 78px;
  padding: 14px 24px;
}

.word-template-name {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.word-template-name strong {
  min-width: 0;
  color: #111a44;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.word-template-row p {
  margin: 0;
  color: #53658f;
  font-weight: 700;
  line-height: 1.55;
}

.word-template-row small {
  color: #61739c;
  font-weight: 700;
}

.word-template-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.word-template-avatar.tone-blue {
  color: #1264f1;
  background: #e9f1ff;
}

.word-template-avatar.tone-purple {
  color: #7b2ff2;
  background: #f1e6ff;
}

.word-template-avatar.tone-green {
  color: #15965d;
  background: #e2f8ed;
}

.word-template-avatar.tone-orange {
  color: #f06a16;
  background: #fff0df;
}

.word-template-avatar.tone-pink {
  color: #f03268;
  background: #ffe7ef;
}

.word-variable-pill {
  justify-self: start;
  padding: 5px 10px;
  border-radius: 6px;
  background: #eaf2ff;
  color: #075ee8;
  font-size: 0.8rem;
  font-weight: 900;
}

.word-template-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.icon-action {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #d8e3f4;
  border-radius: 6px;
  background: #fff;
  color: #172b5f;
}

.icon-action.danger {
  border-color: #ff9bb0;
  color: #ff2d55;
}

.word-template-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.word-template-row-wrap .word-template-form {
  margin: 0 24px 22px;
  background: #f8fbff;
}

.word-template-form-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.word-template-form-head h3 {
  margin: 0 0 4px;
  color: #111a44;
  font-size: 1.05rem;
}

.word-template-form-head p {
  margin: 0;
  color: #61739c;
  font-weight: 700;
}

.word-template-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.word-variable-editor {
  display: grid;
  gap: 10px;
}

.word-variable-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #17204b;
  font-weight: 900;
}

.word-variable-editor-head span {
  color: #53658f;
  font-size: 0.85rem;
}

.word-template-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.word-template-empty {
  padding: 24px;
}

@media (max-width: 980px) {
  .word-template-hero,
  .word-template-form-head {
    flex-direction: column;
    align-items: stretch;
  }

  .word-template-toolbar,
  .word-template-form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .word-search {
    width: 100%;
  }

  .word-template-table {
    overflow-x: auto;
  }

  .word-template-table-head,
  .word-template-row {
    min-width: 880px;
  }

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

@media (max-width: 640px) {
  .word-template-form-grid {
    grid-template-columns: 1fr;
  }

  .word-template-row-wrap .word-template-form {
    margin-inline: 12px;
  }

  .word-template-table-card > h3,
  .word-template-table-head,
  .word-template-row {
    padding-inline: 14px;
  }
}

.plugin-list {
  display: grid;
  gap: 10px;
}

.plugin-toggle {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.plugin-toggle span {
  display: grid;
  gap: 4px;
}

.plugin-toggle small {
  color: var(--muted);
  font-weight: 700;
}

.contact-inline-detail {
  display: none;
}

.contact-select-line {
  display: grid;
  place-items: center;
  min-height: 68px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-result-list button em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
}

.contact-detail-form {
  overflow: hidden;
}

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

.contact-csv-mapping {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.contact-import-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--navy);
}

.contact-import-loading h3,
.contact-import-loading p {
  margin: 0;
}

.contact-import-loading p {
  margin-top: 4px;
  color: var(--muted);
}

.contact-import-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 4px solid #bfdbfe;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: contactImportSpin 0.8s linear infinite;
}

@keyframes contactImportSpin {
  to {
    transform: rotate(360deg);
  }
}

.contact-csv-mapping h4,
.contact-csv-mapping p {
  margin: 0;
}

.contact-csv-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.contact-csv-map-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-fieldset {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-fieldset legend {
  padding: 0 5px;
  color: var(--navy);
  font-weight: 850;
}

.contact-fieldset label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: auto;
  color: var(--ink);
  font-weight: 750;
}

.contact-field-create,
.contact-field-row form {
  min-width: 0;
}

.contact-field-row .contact-form-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.keyword-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.admin-crud {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 14px;
}

.admin-table {
  display: grid;
  gap: 10px;
}

.admin-row,
.activity-row {
  padding: 14px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-row form,
.admin-user-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
}

.admin-row textarea {
  min-height: 90px;
}

.admin-user-actions {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.activity-row {
  display: grid;
  grid-template-columns: 140px 180px 1fr;
  gap: 10px;
}

.admin-row.is-unread {
  border-color: rgba(178, 48, 61, 0.35);
  background: #fff8f8;
}

@media (max-width: 1080px) {
  .admin-shell,
  .admin-split,
  .admin-crud,
  .admin-row,
  .task-command-panel,
  .task-quick-create,
  .task-card-head,
  .task-card-grid,
  .permanence-layout,
  .team-grid,
  .team-overview,
  .team-kpis,
  .team-load,
  .contact-io-grid,
  .contact-create-grid,
  .contact-io-tabs,
  .template-studio-head,
  .template-studio-grid,
  .death-layout,
  .death-relative-add,
  .death-relative-row {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

  .admin-sidebar nav,
  .admin-metrics,
  .admin-dashboard-grid,
  .admin-search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-topbar,
  .admin-filterbar,
  .contact-search-head,
  .parliament-toolbar,
  .parliament-create-card,
  .parliament-add-column {
    grid-template-columns: 1fr;
  }

  .contact-filter-grid,
  .contact-form-grid,
  .contact-csv-map-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-io-tabs button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .contact-io-tabs button:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 680px) {
  .admin-sidebar nav,
  .admin-metrics,
  .admin-dashboard-grid,
  .admin-search-results,
  .admin-row form,
  .admin-user-actions,
    .activity-row,
    .contact-filter-grid,
    .contact-form-grid,
    .contact-io-grid,
    .contact-create-grid,
    .contact-io-tabs,
    .contact-csv-map-grid {
    grid-template-columns: 1fr;
  }

  .contact-form-grid label:has(textarea) {
    grid-column: auto;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(45, 111, 182, 0.1), transparent 30vw),
    linear-gradient(180deg, rgba(247, 248, 251, 0.88), rgba(247, 248, 251, 0.98) 560px);
  background-color: var(--paper);
  min-width: 320px;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

a,
button,
input,
select,
textarea {
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover,
.social-button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.rich-editor:focus-visible {
  border-color: rgba(45, 111, 182, 0.62);
  box-shadow: var(--focus);
  outline: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 54px);
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(198, 208, 222, 0.78);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 30px rgba(18, 27, 41, 0.06);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background:
    linear-gradient(90deg, #fff 0 31%, transparent 31% 69%, #d73545 69%),
    linear-gradient(135deg, var(--navy), var(--red));
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(22, 55, 101, 0.18);
}

.brand h1,
.brand p,
.hero p,
footer p {
  margin: 0;
}

.brand h1 {
  font-size: 1.1rem;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}

.nav-link,
.menu-toggle,
.primary-action,
.secondary-action,
.import-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
}

.nav-link {
  padding: 10px 13px;
  color: var(--navy);
  font-weight: 850;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(24, 47, 87, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.78) inset;
}

.nav-link:hover {
  color: var(--navy-dark);
  background: #fff;
  border-color: rgba(45, 111, 182, 0.28);
}

.nav-link.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  border-color: var(--navy);
  box-shadow: 0 12px 24px rgba(22, 55, 101, 0.2);
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.menu-toggle {
  display: none;
  width: 44px;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 3px auto;
  background: var(--ink);
}

.hero {
  position: relative;
  min-height: 62vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  align-items: end;
  gap: clamp(24px, 5vw, 64px);
  padding: clamp(54px, 8vw, 108px) clamp(18px, 4vw, 54px) 46px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 18px clamp(12px, 2vw, 28px) auto auto;
  width: min(34vw, 420px);
  height: 8px;
  background: linear-gradient(90deg, var(--navy) 0 33%, #fff 33% 66%, var(--red) 66%);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(18, 27, 41, 0.12);
  opacity: 0.88;
}

.hero::after {
  content: "";
  position: absolute;
  right: max(-12vw, -160px);
  bottom: -140px;
  width: min(48vw, 620px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(45, 111, 182, 0.13), transparent 62%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 850px;
}

.hero h2 {
  max-width: 780px;
  margin: 10px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 5.8vw, 5.25rem);
  line-height: 0.96;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-search {
  display: grid;
  grid-template-columns: minmax(220px, 520px) auto;
  gap: 10px;
  max-width: 760px;
  margin-top: 24px;
}

.hero-search input {
  min-width: 0;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(198, 208, 222, 0.9);
  box-shadow: var(--shadow-soft);
}

.hero-brief {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  max-width: 390px;
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 255, 255, 0.82)),
    linear-gradient(135deg, rgba(45, 111, 182, 0.08), rgba(178, 48, 61, 0.06));
  border: 1px solid rgba(198, 208, 222, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-brief::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 54px;
  height: 36px;
  background: linear-gradient(90deg, var(--navy) 0 33%, #fff 33% 66%, var(--red) 66%);
  border: 1px solid rgba(198, 208, 222, 0.75);
  border-radius: 4px;
  box-shadow: 0 10px 20px rgba(18, 27, 41, 0.13);
}

.flag-strip {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 4px;
  height: 26px;
}

.flag-strip span {
  border-radius: 3px;
}

.flag-strip span:nth-child(1) {
  background: var(--navy);
}

.flag-strip span:nth-child(2) {
  background: #fff;
  border: 1px solid var(--line);
}

.flag-strip span:nth-child(3) {
  background: var(--red);
}

.hero-brief h3 {
  margin: 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  line-height: 1;
}

.hero-brief p {
  margin: 0;
  max-width: 280px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-brief-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 62px;
}

.data-actions,
.filters,
.map-actions,
.social-row,
.footer-social-links,
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-weight: 800;
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 12px 24px rgba(178, 48, 61, 0.22);
}

.primary-action:hover {
  box-shadow: 0 16px 30px rgba(178, 48, 61, 0.28);
}

.secondary-action,
.import-button {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.82) inset;
}

.secondary-action:hover,
.import-button:hover {
  border-color: rgba(45, 111, 182, 0.34);
  background: #fff;
}

.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 54px) 58px;
}

body.home-mode .summary-panel {
  grid-column: 1;
  grid-row: 1 / span 20;
}

body.home-mode .tab-panel {
  grid-column: 2;
}

body:not(.home-mode):not(.admin-mode) .workspace {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
  padding-top: clamp(22px, 4vw, 48px);
}

body:not(.home-mode):not(.admin-mode) .tab-panel {
  grid-column: 1;
}

.summary-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 10px;
}

.summary-panel div,
.tab-panel,
.timeline-card,
.law-card,
.month-block,
.admin-form,
.data-panel,
.custom-section {
  background: var(--panel);
  border: 1px solid rgba(198, 208, 222, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.summary-panel div {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: var(--panel-strong);
}

.summary-panel div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--navy), var(--red));
}

.summary-panel div:nth-child(4) {
  border-color: rgba(168, 50, 62, 0.25);
}

.metric {
  display: block;
  color: var(--navy);
  font-size: 2.1rem;
  font-weight: 900;
}

.summary-panel p {
  margin: 4px 0 0;
  color: var(--muted);
}

.tab-panel {
  display: none;
  min-height: 520px;
  padding: clamp(18px, 3vw, 30px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.88)),
    radial-gradient(circle at top right, rgba(45, 111, 182, 0.08), transparent 34%);
}

.tab-panel.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  line-height: 1.15;
  text-wrap: balance;
}

select,
input,
textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

select,
input {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 190px;
  padding: 12px;
  resize: vertical;
}

.timeline {
  position: relative;
  display: grid;
  gap: 16px;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 8px;
  width: 2px;
  background: linear-gradient(var(--navy), var(--red));
}

.timeline-card {
  position: relative;
  padding: 18px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.timeline-card::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 24px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--red), var(--navy));
  border: 4px solid var(--paper);
  border-radius: 50%;
}

.timeline-card:hover,
.law-card:hover,
.search-result:hover,
.month-block:hover,
.request-card:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 111, 182, 0.28);
  box-shadow: 0 22px 48px rgba(18, 27, 41, 0.13);
}

.timeline-card time,
.law-card .meta,
.event-date {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-card h3,
.law-card h3,
.month-block h3,
.data-panel h3,
.custom-section h3 {
  margin: 8px 0;
}

.timeline-card p,
.law-card p,
.data-panel p,
.custom-section p {
  color: var(--muted);
  line-height: 1.58;
}

.agenda-groups {
  display: grid;
  gap: 18px;
}

.agenda-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 18px;
  margin-bottom: 22px;
}

.map-panel,
.commune-panel {
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(217, 222, 231, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.map-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.map-heading h3,
.commune-panel h3 {
  margin: 0 0 5px;
}

.map-heading p,
.commune-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.map-actions {
  justify-content: flex-end;
}

.haute-saone-map {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(45, 111, 182, 0.08), rgba(178, 48, 61, 0.05)),
    #fbfbf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  overscroll-behavior: contain;
}

.haute-saone-map.is-dragging {
  cursor: grabbing;
}

.haute-saone-map svg {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: center center;
  transition: transform 160ms ease;
}

.commune-shape {
  fill: #f2f5f9;
  stroke: rgba(24, 47, 87, 0.18);
  stroke-width: 0.8;
  transition: fill 160ms ease, stroke 160ms ease;
}

.commune-shape.has-posts {
  fill: #dfe9f6;
  cursor: pointer;
}

.commune-shape:hover,
.commune-shape.is-selected {
  fill: #d8e2f1;
  stroke: var(--navy);
  stroke-width: 1.6;
}

.paper-pin {
  cursor: pointer;
  filter: drop-shadow(0 7px 8px rgba(23, 32, 43, 0.24));
}

.paper-pin path {
  fill: var(--red);
  stroke: #fff;
  stroke-width: 3;
}

.paper-pin circle {
  fill: #fff;
}

.paper-pin text {
  fill: var(--navy);
  font-size: 11px;
  font-weight: 950;
  pointer-events: none;
}

.paper-pin.is-selected path {
  fill: var(--navy);
}

.commune-posts {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.commune-posts article {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.commune-posts time {
  display: block;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.commune-posts strong {
  display: block;
  margin: 4px 0;
}

.month-block {
  padding: 18px;
}

.month-timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-left: 18px;
  border-left: 2px solid var(--line);
}

.event-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(217, 222, 231, 0.72);
}

.event-row:last-child {
  border-bottom: 0;
}

.event-row h4 {
  margin: 0 0 4px;
}

.event-row p {
  margin: 0;
  color: var(--muted);
}

.event-row.image-right .article-image {
  float: right;
  margin: 2px 0 10px 14px;
}

.moderation-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.moderation-panel label {
  min-width: 170px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.law-card {
  padding: 18px;
}

.search-console {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.search-console input {
  min-height: 52px;
}

.secondary-action.is-selected {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.search-results {
  display: grid;
  gap: 12px;
}

.search-result,
.detail-article,
.legal-grid article,
.vote-board,
.video-rail,
.parliament-metrics article,
.mandate-cards article {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-result {
  padding: 16px;
}

.search-result span,
.detail-article .meta {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.search-result h3 {
  margin: 6px 0;
}

.search-result p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.parliament-overview,
.mandate-dashboard {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.parliament-metrics,
.mandate-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.parliament-metrics article,
.mandate-cards article {
  padding: 16px;
}

.parliament-metrics strong,
.mandate-cards strong {
  display: block;
  color: var(--navy);
  font-size: 2rem;
  font-weight: 950;
}

.parliament-metrics article,
.mandate-cards article,
.stat-card {
  position: relative;
  overflow: hidden;
}

.parliament-metrics article::after,
.mandate-cards article::after,
.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 82px;
  height: 82px;
  background: radial-gradient(circle, rgba(178, 48, 61, 0.12), transparent 68%);
}

.parliament-metrics span,
.mandate-cards span {
  color: var(--muted);
  font-weight: 850;
}

.vote-board,
.video-rail {
  padding: 18px;
}

.vote-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.vote-row time {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.vote-row p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.vote-position {
  padding: 6px 10px;
  color: #fff;
  font-weight: 900;
  background: var(--green);
  border-radius: 999px;
}

.video-rail {
  margin-top: 18px;
}

.video-rail > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.video-rail article {
  display: grid;
  gap: 8px;
}

.mandate-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr);
  gap: 18px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-list span,
.compact-list small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.detail-article {
  padding: clamp(18px, 4vw, 34px);
}

.detail-article h2 {
  max-width: 860px;
  margin: 10px 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.detail-body {
  max-width: 850px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.75;
}

.detail-url {
  padding: 10px 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  background: #f2f4f7;
  border-radius: 8px;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.legal-grid article {
  padding: 18px;
}

.inline-note {
  margin-bottom: 16px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tag {
  padding: 6px 9px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 800;
  background: linear-gradient(180deg, #edf4fb, #e8eef7);
  border: 1px solid rgba(45, 111, 182, 0.1);
  border-radius: 999px;
}

.newsletter-form,
.admin-layout {
  display: grid;
  gap: 18px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
}

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

label,
legend {
  color: var(--muted);
  font-weight: 800;
}

label input,
label select,
label textarea {
  margin-top: 6px;
}

fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.check-grid label,
.consent {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 650;
}

.check-grid input,
.consent input,
.check-line input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.feedback {
  min-height: 24px;
  margin: 0;
  color: var(--green);
  font-weight: 800;
  line-height: 1.35;
}

.feedback.is-error {
  color: var(--red);
}

.feedback.is-success {
  color: var(--green);
}

.is-hidden {
  display: none !important;
}

.admin-layout {
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 0.9fr);
  align-items: start;
  margin-top: 18px;
}

.admin-form,
.data-panel {
  padding: 18px;
}

.embedded-form {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.admin-fields {
  margin: 12px 0;
}

.import-button {
  position: relative;
  overflow: hidden;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.custom-sections {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.custom-section {
  padding: 18px;
}

.auth-required {
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-required h3 {
  margin: 0 0 8px;
}

.auth-required p {
  margin: 0 0 14px;
  color: var(--muted);
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-tab,
.profile-tab {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--navy);
  font-weight: 850;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-tab:hover,
.profile-tab:hover {
  border-color: rgba(45, 111, 182, 0.34);
}

.admin-tab.is-active,
.profile-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: var(--red);
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-screen,
.profile-screen {
  display: none;
}

.admin-screen.is-active,
.profile-screen.is-active {
  display: block;
}

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

.stat-card {
  padding: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--navy);
  font-size: 2.3rem;
  font-weight: 950;
}

.stat-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-chart div {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
}

.bar-chart span {
  color: var(--muted);
  font-weight: 800;
}

.bar-chart strong {
  display: block;
  min-width: 28px;
  padding: 6px 8px;
  color: #fff;
  background: linear-gradient(90deg, var(--navy), var(--blue));
  border-radius: 6px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.keyword-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--navy);
  font-weight: 850;
  background: #edf2f9;
  border-radius: 999px;
}

.keyword-pill button,
.danger-action {
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 6px;
}

.keyword-pill button {
  width: 22px;
  height: 22px;
}

.danger-action {
  min-height: 34px;
  margin-top: 12px;
  padding: 7px 10px;
  font-weight: 800;
}

.danger-action.compact {
  min-height: 32px;
  margin-top: 0;
}

.admin-content-actions,
.form-actions,
.request-admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.video-feature {
  display: block;
  width: 100%;
  margin: 14px 0;
  overflow: hidden;
  background: #101820;
  border: 1px solid var(--line);
  border-radius: 8px;
  aspect-ratio: 16 / 9;
}

.video-feature iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-link {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 220px;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.video-link small {
  opacity: 0.78;
}

.support-folder {
  display: grid;
  gap: 12px;
}

.support-folder h4 {
  margin: 8px 0 0;
  color: var(--navy);
}

.editor-shell {
  display: grid;
  gap: 8px;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
}

.editor-toolbar button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--navy);
  font-weight: 900;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.rich-editor {
  min-height: 190px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.6;
}

.article-image {
  float: left;
  width: 128px;
  height: 92px;
  object-fit: cover;
  margin: 2px 14px 10px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #edf2f9;
  box-shadow: var(--shadow-soft);
}

.event-row .article-image {
  width: 96px;
  height: 72px;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  grid-template-columns: 1.2fr 180px 220px;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-row p {
  margin: 5px 0 0;
  color: var(--muted);
}

.request-list {
  display: grid;
  gap: 12px;
}

.request-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.request-card h4 {
  margin: 0 0 4px;
}

.request-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.support-thread {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.thread-message {
  max-width: 78%;
  padding: 10px 12px;
  background: #edf2f9;
  border-radius: 8px;
}

.thread-message.from-team {
  margin-left: auto;
  color: #fff;
  background: var(--navy);
}

.thread-message span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.74rem;
  font-weight: 900;
  opacity: 0.82;
}

.thread-message p,
.thread-message.from-team p {
  color: inherit;
}

.thread-empty {
  font-size: 0.9rem;
}

.support-reply-form {
  display: grid;
  gap: 8px;
}

.support-reply-form textarea {
  min-height: 90px;
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  background: #edf2f9;
  border-radius: 999px;
}

.status-pill.status-en-cours {
  color: #fff;
  background: var(--navy);
}

.status-pill.status-cloturee {
  color: #fff;
  background: var(--green);
}

.status-pill.status-refusee {
  color: #fff;
  background: var(--red);
}

input[readonly] {
  color: var(--muted);
  background: #f2f4f7;
}

footer {
  padding: 30px clamp(18px, 4vw, 54px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.footer-link {
  display: inline-flex;
  min-height: 0;
  margin-bottom: 10px;
  padding: 0;
  color: var(--navy);
  font-weight: 850;
  text-decoration: underline;
  background: transparent;
  border: 0;
}

.footer-social-links {
  margin-bottom: 12px;
}

.social-row {
  margin-top: 12px;
}

.social-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 950;
  text-decoration: none;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.social-facebook {
  background: #1b5fd6;
}

.social-instagram {
  background: #b83274;
}

.social-linkedin {
  background: #0a66c2;
}

.social-tiktok {
  background: #111;
}

.social-twitter,
.social-threads {
  background: #17202b;
}

.social-assembly {
  background: var(--red);
}

.site-toast {
  position: fixed;
  right: clamp(16px, 4vw, 34px);
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  color: #fff;
  font-weight: 850;
  line-height: 1.4;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* UI refresh */
:root {
  --surface: rgba(255, 255, 255, 0.94);
  --surface-muted: rgba(247, 249, 252, 0.92);
  --header-height: 74px;
  --shadow: 0 18px 38px rgba(18, 27, 41, 0.1);
  --shadow-soft: 0 8px 22px rgba(18, 27, 41, 0.07);
}

body {
  background:
    radial-gradient(circle at 78% 10%, rgba(178, 48, 61, 0.08), transparent 26vw),
    linear-gradient(180deg, rgba(248, 250, 253, 0.94), rgba(244, 247, 251, 0.99) 620px);
  color: #111827;
  line-height: 1.5;
}

body::selection {
  color: #fff;
  background: var(--navy);
}

button,
input,
select,
textarea,
.rich-editor {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

.site-header {
  min-height: var(--header-height);
  padding-block: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(198, 208, 222, 0.7);
}

.brand-mark {
  flex: 0 0 auto;
}

.main-nav {
  align-items: center;
}

.nav-link {
  min-height: 38px;
  padding: 9px 12px;
  color: #1a3760;
  font-size: 0.9rem;
  white-space: nowrap;
}

.account-bar span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero {
  min-height: clamp(540px, 70vh, 760px);
  align-items: center;
  padding-top: clamp(56px, 7vw, 96px);
  padding-bottom: clamp(34px, 5vw, 64px);
}

.hero h2,
.detail-article h2 {
  letter-spacing: 0;
}

.hero p {
  font-size: clamp(1rem, 1.2vw, 1.14rem);
}

.hero-search {
  padding: 6px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(198, 208, 222, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.hero-search input {
  box-shadow: none;
}

.hero-search .primary-action {
  min-width: 132px;
}

.hero-brief,
.summary-panel div,
.tab-panel,
.timeline-card,
.law-card,
.month-block,
.admin-form,
.data-panel,
.custom-section,
.map-panel,
.commune-panel,
.search-result,
.detail-article,
.legal-grid article,
.vote-board,
.video-rail,
.parliament-metrics article,
.mandate-cards article,
.stat-card,
.request-card,
.auth-required {
  background: var(--surface);
}

.workspace {
  align-items: start;
}

.summary-panel {
  gap: 12px;
}

.summary-panel div {
  min-height: 118px;
}

.metric {
  line-height: 1;
}

.tab-panel {
  min-width: 0;
  border-color: rgba(198, 208, 222, 0.72);
}

.section-heading {
  align-items: end;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  max-width: 880px;
}

.filters select,
.section-heading select {
  min-width: min(230px, 100%);
}

select,
input,
textarea,
.rich-editor {
  min-width: 0;
  background: #fff;
}

input,
select,
textarea {
  font-size: 1rem;
}

.primary-action,
.secondary-action,
.import-button,
.admin-tab,
.profile-tab,
.contact-tabs button,
.editor-toolbar button,
.icon-button,
.danger-action {
  min-width: 0;
}

.primary-action,
.secondary-action,
.import-button {
  text-align: center;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.timeline-card,
.law-card,
.search-result,
.request-card,
.month-block {
  overflow: hidden;
}

.timeline-card h3,
.law-card h3,
.search-result h3,
.request-card h4 {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.article-image {
  max-width: 44%;
}

.haute-saone-map {
  min-height: clamp(300px, 48vw, 480px);
}

.map-heading,
.request-card header {
  min-width: 0;
}

.video-rail article,
.commune-posts article,
.compact-list button,
.admin-panel button,
.admin-list button,
.user-row {
  min-width: 0;
}

.thread-message {
  overflow-wrap: anywhere;
}

.admin-shell {
  min-width: 0;
}

.admin-topbar,
.admin-filterbar,
.admin-row,
.activity-row,
.contact-result-row {
  min-width: 0;
}

.site-toast {
  left: auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 900px) {
  .site-header {
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 10px 16px;
  }

  .menu-toggle {
    display: grid;
    flex: 0 0 44px;
    margin-left: auto;
  }

  .main-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    left: 12px;
    display: none;
    max-height: calc(100vh - 92px);
    padding: 10px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(198, 208, 222, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .main-nav.is-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .main-nav .nav-link {
    width: 100%;
    justify-content: center;
    white-space: normal;
  }

  .workspace,
  .hero,
  .admin-layout,
  .auth-layout,
  .agenda-map-layout,
  .mandate-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace {
    padding-inline: 16px;
  }

  .hero {
    min-height: auto;
    align-items: start;
    gap: 18px;
    padding-inline: 16px;
  }

  .hero-brief {
    max-width: 100%;
  }

  .summary-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand {
    min-width: 0;
  }

  .account-bar {
    min-width: 0;
  }

  .admin-topbar {
    position: static;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 64px;
  }

  body {
    background-attachment: scroll;
  }

  .hero {
    min-height: auto;
    padding: 36px 16px 32px;
    max-width: 100vw;
  }

  .hero > * {
    width: 100%;
    max-width: 100%;
    justify-self: start;
  }

  .hero h2 {
    max-width: none;
    font-size: clamp(2rem, 10vw, 2.72rem);
    line-height: 0.98;
    text-wrap: auto;
  }

  .hero p {
    line-height: 1.62;
  }

  .hero::before {
    inset-inline: 16px;
    width: auto;
  }

  .site-header {
    gap: 10px;
  }

  .account-bar {
    display: none;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .brand .eyebrow {
    font-size: 0.66rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .section-heading,
  .event-row,
  .vote-row,
  .hero-search {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-search {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .hero-search .primary-action,
  .primary-action,
  .secondary-action,
  .import-button {
    width: 100%;
    min-height: 46px;
  }

  .event-row.image-right .article-image {
    float: left;
    margin: 2px 14px 10px 0;
  }

  .summary-panel,
  .form-grid,
  .stats-grid,
  .user-row,
  .parliament-metrics,
  .mandate-cards,
  .admin-metrics,
  .admin-dashboard-grid,
  .admin-search-results,
  .admin-row form,
  .admin-user-actions,
  .activity-row,
  .contact-filter-grid,
  .contact-form-grid,
  .contact-csv-map-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel div {
    min-height: auto;
  }

  .workspace {
    gap: 16px;
    padding: 0 12px 38px;
  }

  .tab-panel {
    min-height: 0;
    padding: 16px;
  }

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

  .section-heading select,
  .filters select {
    min-width: 0;
  }

  .filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-tabs,
  .profile-tabs,
  .data-actions,
  .map-actions,
  .share-row,
  .form-actions,
  .request-admin-controls,
  .hero-brief-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-brief-actions {
    padding-right: 0;
  }

  .hero-brief::after {
    opacity: 0.35;
  }

  .main-nav.is-open {
    grid-template-columns: 1fr;
  }

  .map-heading,
  .request-card header,
  .admin-detail-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .month-timeline,
  .timeline {
    padding-left: 0;
    border-left: 0;
  }

  .timeline::before,
  .timeline-card::before {
    display: none;
  }

  .article-image,
  .event-row .article-image,
  .event-row.image-right .article-image {
    float: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 8px 0 12px;
  }

  .haute-saone-map {
    min-height: 300px;
  }

  .vote-position,
  .status-chip {
    justify-self: start;
  }

  .thread-message {
    max-width: 100%;
  }

  footer {
    padding: 24px 16px;
  }

  .site-toast {
    right: 12px;
    bottom: 14px;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 680px) {
  body.admin-mode .admin-workbench {
    padding: 12px 10px 28px;
  }

  body.admin-mode .admin-sidebar {
    padding: 14px;
    gap: 12px;
  }

  .contacts-admin {
    gap: 10px;
  }

  .contact-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(130px, 1fr);
    gap: 8px;
    margin-inline: -2px;
    padding: 2px 2px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .contact-tabs button {
    width: 100%;
    min-height: 42px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .contact-search-panel {
    position: sticky;
    top: 0;
    z-index: 4;
    max-height: 58vh;
    overflow-y: auto;
    padding: 12px;
    border-color: rgba(198, 208, 222, 0.9);
    box-shadow: 0 12px 24px rgba(18, 27, 41, 0.12);
  }

  .contact-search-head {
    gap: 10px;
  }

  .contact-search-head h3 {
    font-size: 1rem;
  }

  .contact-search-head p,
  .contact-pagination-controls span {
    font-size: 0.86rem;
  }

  .contact-search-panel fieldset {
    padding: 12px;
  }

  .contact-search-primary-actions {
    grid-template-columns: 1fr 1fr;
  }

  .contact-search-primary-actions input,
  .contact-search-primary-actions .contact-pagination-controls {
    grid-column: 1 / -1;
  }

  .contact-filter-section summary {
    min-height: 42px;
    padding: 10px;
  }

  .contact-filter-section > fieldset,
  .contact-filter-section > .contact-filter-grid,
  .contact-filter-section > .contact-age-filter,
  .contact-filter-section > .contact-pagination-controls,
  .contact-filter-section > .data-actions {
    margin: 10px;
  }

  .contact-pagination-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .contact-pagination-controls label,
  .contact-pagination-controls span {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .contact-split {
    gap: 10px;
    margin-top: 10px;
  }

  .contact-split > .admin-detail {
    display: block;
  }

  .contact-sticky-detail {
    position: static;
    max-height: none;
  }

  .contact-result-list {
    gap: 10px;
  }

  .contact-result-row {
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(18, 27, 41, 0.06);
  }

  .contact-result-row.is-active {
    border-color: rgba(178, 48, 61, 0.34);
    background: #fffafa;
  }

  .contact-result-main {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .contact-select-line {
    min-height: 64px;
  }

  .contact-inline-detail {
    display: block;
    padding-top: 8px;
  }

  .contact-inline-detail .admin-form {
    padding: 12px;
    border-color: rgba(198, 208, 222, 0.9);
    box-shadow: none;
  }

  .contact-inline-detail .admin-detail-head {
    gap: 8px;
  }

  .contact-detail-form textarea {
    min-height: 120px;
  }

  .contact-form-grid label:has(textarea) {
    grid-column: auto;
  }

  .admin-crud {
    gap: 10px;
  }

  .admin-crud > .admin-form {
    position: static;
  }

  .admin-table {
    gap: 10px;
  }

  .admin-row {
    padding: 12px;
  }

  .admin-row form {
    gap: 8px;
  }
}

/* Correctif final des onglets publics */
body:not(.admin-mode) main {
  width: 100%;
}

body:not(.home-mode):not(.admin-mode) .workspace {
  width: min(100%, 1380px);
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 1380px;
  margin: 0 auto;
  padding-top: clamp(22px, 4vw, 48px);
}

body:not(.home-mode):not(.admin-mode) .tab-panel {
  grid-column: 1;
}

body.home-mode .workspace {
  max-width: 1380px;
  margin: 0 auto;
}

body.home-mode .summary-panel {
  grid-column: 1;
  grid-row: 1 / span 50;
}

body.home-mode .tab-panel {
  grid-column: 2;
}

.tab-panel {
  max-width: none;
  min-height: min(720px, calc(100vh - 170px));
  padding: clamp(22px, 3vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 254, 0.94)),
    radial-gradient(circle at 96% 0%, rgba(178, 48, 61, 0.05), transparent 30%);
}

.section-heading {
  position: relative;
  align-items: center;
  min-height: 86px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(198, 208, 222, 0.72);
}

.section-heading::before {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 78px;
  height: 3px;
  background: linear-gradient(90deg, var(--navy), var(--red));
  border-radius: 999px;
}

.section-heading .eyebrow {
  margin-bottom: 6px;
}

.section-heading h2 {
  max-width: 980px;
  margin: 0;
  color: #111827;
  font-size: clamp(1.55rem, 2.4vw, 2.45rem);
  line-height: 1.12;
}

.section-heading select,
.filters select,
.search-console input,
.newsletter-form input,
.newsletter-form select,
.auth-layout input,
.auth-layout select {
  border-color: rgba(198, 208, 222, 0.95);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset;
}

.mandate-dashboard,
.parliament-overview,
.agenda-groups,
.search-results,
.content-grid,
.timeline {
  margin-top: 22px;
}

.mandate-cards,
.parliament-metrics {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.mandate-cards article,
.parliament-metrics article,
.summary-panel div {
  min-height: 112px;
  display: grid;
  align-content: center;
}

.mandate-cards strong,
.parliament-metrics strong,
.metric {
  font-size: clamp(2rem, 3vw, 2.7rem);
}

.agenda-map-layout {
  grid-template-columns: minmax(420px, 1.6fr) minmax(300px, 0.8fr);
  align-items: stretch;
}

.map-panel,
.commune-panel,
.month-block,
.timeline-card,
.law-card,
.search-result,
.mandate-cards article,
.parliament-metrics article {
  border-color: rgba(198, 208, 222, 0.88);
  box-shadow: 0 14px 34px rgba(18, 27, 41, 0.08);
}

.map-panel,
.commune-panel {
  min-width: 0;
}

.haute-saone-map {
  min-height: clamp(360px, 42vw, 560px);
  background:
    linear-gradient(135deg, rgba(45, 111, 182, 0.06), rgba(178, 48, 61, 0.035)),
    #f8fafc;
}

.month-block h3,
.timeline-card h3,
.law-card h3,
.search-result h3 {
  color: #101827;
  font-size: clamp(1.02rem, 1.2vw, 1.24rem);
}

.event-row {
  grid-template-columns: minmax(96px, 128px) minmax(0, 1fr);
}

.event-row > div,
.timeline-card,
.law-card,
.search-result,
.commune-posts article {
  min-width: 0;
}

.event-row h4,
.event-row p,
.timeline-card h3,
.timeline-card p,
.law-card h3,
.law-card p,
.search-result h3,
.search-result p {
  overflow-wrap: anywhere;
}

.search-console {
  grid-template-columns: minmax(260px, 1fr);
  padding: 14px;
  background: rgba(248, 250, 253, 0.86);
  border: 1px solid rgba(198, 208, 222, 0.76);
  border-radius: 8px;
}

.search-filters {
  gap: 8px;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
}

.newsletter-form,
.support-form,
.auth-layout,
.profile-screen,
.legal-grid,
.parliament-overview,
.mandate-dashboard {
  max-width: 1180px;
}

@media (max-width: 1180px) {
  .agenda-map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .commune-panel {
    order: -1;
  }
}

@media (max-width: 760px) {
  body:not(.home-mode):not(.admin-mode) .workspace,
  body.home-mode .workspace {
    padding-inline: 12px;
    padding-top: 16px;
  }

  body.home-mode .tab-panel,
  body:not(.home-mode):not(.admin-mode) .tab-panel {
    grid-column: 1;
  }

  .tab-panel {
    padding: 16px;
    min-height: 0;
  }

  .section-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    min-height: 0;
  }

  .section-heading h2 {
    font-size: clamp(1.35rem, 8vw, 2rem);
  }

  .event-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .map-actions,
  .filters,
  .search-filters {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}
