:root {
  --bg: #101114;
  --bg-2: #090a0d;
  --panel: #15181e;
  --panel-2: #191d24;
  --panel-3: #202631;
  --line: #303641;
  --text: #f8fafc;
  --muted: #aeb6c2;
  --accent: #2f6fed;
  --accent-2: #255bcc;
  --gold: #d1a84b;
  --danger: #c8332d;
  --good: #10b981;
  --warn: #f59e0b;
  --pink: #ec4899;
  --cyan: #38bdf8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: 34px 38px 1fr 22px;
}

.app.no-commandbar {
  grid-template-rows: 34px 1fr 22px;
}

.app.no-commandbar .commandbar {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 12px;
  background: var(--bg-2);
  border-bottom: 1px solid #1e293b;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  color: var(--muted);
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: stretch;
  background: #0c0e12;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}

.tabs a {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 13px;
  border-right: 1px solid var(--line);
  color: var(--text);
}

.tabs a.active {
  color: #fff;
  background: #171b22;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.commandbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #11141a;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}

/* Les boutons doivent tenir dans la hauteur fixe de la barre, sans ascenseur. */
.commandbar .btn {
  min-height: 26px;
  padding: 4px 10px;
}

/* Selecteur de client actif : seul point d entree pour changer de client. */
.client-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  max-width: 340px;
  white-space: nowrap;
}

.client-switch > span {
  color: var(--muted);
}

.client-switch strong {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gold);
}

.client-switch:hover {
  background: #171d26;
}

.client-switch:hover strong {
  color: #fff;
}

.client-switch .caret {
  color: var(--muted);
  font-size: 10px;
}

.client-switch.empty strong {
  color: #fca5a5;
}

.main {
  min-height: 0;
  display: grid;
  grid-template-columns: 200px 1fr;
}

.main.home .page {
  padding: 22px 20px;
}

.modules {
  min-height: 0;
  background: #11151b;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.modules h3 {
  margin: 0;
  padding: 9px 10px;
  background: #0c0e12;
  font-size: 13px;
}

.module-group {
  padding: 8px 10px 4px;
}

.module-group + .module-group {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.module-group strong {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-group a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  color: var(--muted);
}

.module-group a:hover {
  color: #fff;
  background: #171d26;
}

.module-group a.active {
  color: #fff;
  border-left-color: var(--gold);
  background: #1a212c;
  font-weight: 700;
}

.nav-badge {
  min-width: 18px;
  margin-left: auto;
  padding: 1px 5px;
  border-radius: 999px;
  color: #ffd9dd;
  background: #7f1d1d;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

.frame {
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #12161d;
  overflow: auto;
}

.page {
  padding: 14px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.client-context {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #171c24;
  overflow: hidden;
}

.client-identity {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.client-identity strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.client-identity span {
  color: var(--muted);
}

.client-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
}

.client-tabs {
  display: flex;
  overflow-x: auto;
  background: #10151d;
}

.client-tabs a {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.client-tabs a.active {
  color: #fff;
  background: #1b212b;
  box-shadow: inset 0 -2px 0 var(--gold);
}

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

.info-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111821;
}

.info-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.info-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.alert-list {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.alert-list li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 4px;
  background: #111821;
}

.alert-low {
  border-left-color: var(--cyan) !important;
}

.alert-medium {
  border-left-color: var(--warn) !important;
}

.alert-high {
  border-left-color: var(--danger) !important;
}

h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

h3 {
  margin: 0 0 6px;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

/* Formule de calcul et exemples d anomalies sous un libelle de tableau. */
.muted.small {
  font-size: 11px;
  line-height: 1.45;
  margin-top: 2px;
}

/* Ecrans d acces : connexion et premiere definition du mot de passe. */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 26px;
}

.auth-card h1 {
  font-size: 19px;
  margin: 12px 0 4px;
}

.auth-logo {
  max-width: 150px;
  height: auto;
}

.auth-card label {
  display: block;
  margin: 14px 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.auth-card input[type="password"] {
  width: 100%;
}

.auth-card button {
  margin-top: 16px;
  width: 100%;
  justify-content: center;
}

.logout-form {
  display: inline;
  margin-left: 10px;
}

.btn,
button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(91, 141, 245, 0.85);
  border-radius: 4px;
  color: #fff;
  background: var(--accent);
  font: 600 12px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.btn:hover,
button:hover {
  background: var(--accent-2);
}

.btn.secondary,
button.secondary {
  background: #222833;
  border-color: var(--line);
}

.btn.danger,
button.danger {
  background: var(--danger);
  border-color: #ef4444;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
}

.btn.small,
button.small {
  min-height: 25px;
  padding: 4px 8px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

/* Accueil : tuiles de statistiques, volontairement non cliquables. */
.page-head.welcome {
  display: block;
  margin-bottom: 20px;
  padding-bottom: 14px;
}

.page-head.welcome h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 600;
}

.page-head.welcome::after {
  content: "";
  display: block;
  width: 74px;
  height: 2px;
  margin-top: 14px;
  background: var(--gold);
}

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

.stat-card {
  position: relative;
  padding: 16px 18px 16px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: default;
  user-select: none;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 50%;
}

.stat-value {
  display: block;
  margin-bottom: 4px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
}

.stat-label {
  display: block;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-detail {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.stat-card.tone-blue {
  border-left-color: var(--accent);
}

.stat-card.tone-blue .stat-icon {
  color: #7cb0ff;
  background: rgba(47, 111, 237, 0.18);
}

.stat-card.tone-blue .stat-value {
  color: #7cb0ff;
}

.stat-card.tone-green {
  border-left-color: var(--good);
}

.stat-card.tone-green .stat-icon {
  color: #4ade80;
  background: rgba(16, 185, 129, 0.18);
}

.stat-card.tone-green .stat-value {
  color: #4ade80;
}

.stat-card.tone-purple {
  border-left-color: #8b5cf6;
}

.stat-card.tone-purple .stat-icon {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.2);
}

.stat-card.tone-purple .stat-value {
  color: #c4b5fd;
}

.stat-card.tone-red {
  border-left-color: var(--danger);
}

.stat-card.tone-red .stat-icon {
  color: #fca5a5;
  background: rgba(200, 51, 45, 0.2);
}

.stat-card.tone-red .stat-value {
  color: #fca5a5;
}

.stat-card.tone-gold {
  border-left-color: var(--gold);
}

.stat-card.tone-gold .stat-icon {
  color: var(--gold);
  background: rgba(209, 168, 75, 0.18);
}

.stat-card.tone-gold .stat-value {
  color: var(--gold);
}

.tile {
  min-height: 86px;
  display: grid;
  grid-template-columns: 5px 1fr;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: linear-gradient(180deg, #202631 0%, #181d25 100%);
}

.tile .stripe {
  background: var(--accent);
}

.tile .body {
  padding: 10px 11px;
}

.tile strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}

.tile p {
  margin: 0 0 7px;
  color: #d7dee9;
}

.tile b {
  font-size: 17px;
  color: var(--gold);
}

.worksplit {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 36%) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.worksplit.narrow {
  grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
}

.home-panels,
.follow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.panel {
  min-width: 0;
  min-height: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  overflow: visible;
}

.list-panel {
  min-height: calc(100vh - 160px);
}

.panel-block {
  min-width: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.panel > .panel-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.kanban-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  flex: 1 1 160px;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.kanban-title {
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--text);
}

.kanban-card {
  display: block;
  margin: 6px 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--text);
}

.kanban-card:hover {
  border-color: var(--accent);
  background: #1b2430;
}

.small-text {
  font-size: 0.85em;
}

.launch-panel {
  max-width: 760px;
}

.launch-panel p {
  max-width: 640px;
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 6px;
  align-items: end;
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 5px 9px;
  align-items: start;
}

.form-grid label {
  color: var(--muted);
  font-weight: 600;
  padding-top: 7px;
}

.compact-form {
  margin-bottom: 10px;
}

.compact-form .form-grid {
  grid-template-columns: 105px minmax(0, 1fr);
}

input,
select,
textarea {
  width: 100%;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: #111720;
  font: 12px "Segoe UI", Arial, sans-serif;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 1;
  color: #edf2f8;
  background: #171c24;
  border-color: #242a34;
  cursor: default;
}

.editable-form.is-readonly select:disabled {
  appearance: none;
}

.editable-form.is-readonly textarea:disabled {
  resize: none;
}

button:disabled {
  opacity: 1;
  color: #7f8a99;
  background: #1b212b;
  border-color: #2a3240;
  cursor: not-allowed;
}

input::file-selector-button {
  min-height: 24px;
  margin-right: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: #202633;
  font: 600 11px "Segoe UI", Arial, sans-serif;
}

input::file-selector-button:hover {
  background: #263040;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.row-actions {
  white-space: normal;
}

.row-actions form,
.row-actions a {
  display: inline-flex;
  margin: 0 3px 3px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #e5eefb;
  background: #111d30;
  font-weight: 700;
}

.badge.stat-good {
  color: #d1fae5;
  border-color: rgba(16, 185, 129, 0.75);
  background: #0d2a22;
}

.badge.stat-watch {
  color: #fde8c3;
  border-color: rgba(245, 158, 11, 0.75);
  background: #2b2110;
}

.badge.stat-bad {
  color: #ffd9dd;
  border-color: rgba(200, 51, 45, 0.85);
  background: #2c1416;
}

.badge.stat-na {
  color: var(--muted);
}

/* Module Finances : bandeau de parcours, ratios, comparatif et synthese. */
.finance-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  background: var(--panel-2);
}

.finance-bar.empty {
  grid-template-columns: minmax(0, 1fr) auto;
  border-left-color: var(--danger);
}

.finance-bar-id strong {
  display: block;
  font-size: 13px;
}

.finance-bar-id span,
.finance-bar-meta span {
  display: block;
  color: var(--muted);
}

.finance-bar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  max-width: 420px;
}

.finance-bar-meta b {
  color: var(--text);
}

.finance-bar .actions {
  margin: 0;
  justify-content: flex-end;
}

.period-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric-grid.compact .metric {
  min-height: 52px;
  padding: 7px 8px;
}

.metric-grid.compact .metric strong {
  font-size: 15px;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.compare-table td.num,
.ratio-table td.num {
  white-space: nowrap;
}

.delta-up {
  color: var(--good);
}

.delta-down {
  color: #fb7185;
}

.summary-list {
  margin: 0;
  padding-left: 16px;
}

.summary-list li {
  margin-bottom: 3px;
  line-height: 1.45;
}

.questionnaire-section {
  margin-bottom: 8px;
}

.questionnaire-section h2 .badge {
  margin-left: 6px;
  font-weight: 700;
}

.questionnaire-table td .muted {
  margin-top: 3px;
}

.subtabs {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #141922;
}

.subtab-buttons {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: #11161e;
}

.subtab-buttons button {
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.subtab-buttons button.active {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.subtab-panel {
  display: none;
  padding: 10px;
}

.subtab-panel.active {
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  background: #202632;
  color: var(--text);
  font-weight: 700;
}

tr.active td {
  background: #1e5fd7;
  color: #fff;
}

tr:hover td {
  background: #202a38;
}

tr[onclick] {
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.metric {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric strong {
  font-size: 20px;
}

.notice {
  margin-bottom: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
}

.notice.success {
  border-color: rgba(16, 185, 129, 0.7);
}

.notice.error {
  border-color: rgba(239, 68, 68, 0.85);
}

.risk-low {
  color: var(--good);
  font-weight: 700;
}

.risk-medium {
  color: var(--warn);
  font-weight: 700;
}

.risk-high {
  color: #fb7185;
  font-weight: 700;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  color: var(--muted);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}

.statusbar-right {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Onglets internes d un espace de travail (dossier client, projets cabinet). */
.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.workspace-tabs a {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
}

.workspace-tabs a:hover {
  color: #fff;
  background: #171d26;
}

.workspace-tabs a.active {
  color: #fff;
  border-bottom-color: var(--gold);
}

/* Synthese client : bandeau identite, indicateurs et graphique, en lecture seule. */
.summary-identity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  background: var(--panel-2);
}

.summary-identity span {
  display: block;
  color: var(--muted);
}

.summary-identity strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-period {
  margin-bottom: 6px;
}

.summary-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.summary-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  cursor: default;
}

.summary-label {
  display: block;
  color: var(--muted);
}

.summary-value {
  display: block;
  margin: 2px 0;
  font-size: 21px;
  line-height: 1.15;
}

.summary-delta {
  font-weight: 700;
}

.summary-card.tone-blue {
  border-left-color: var(--accent);
}

.summary-card.tone-blue .summary-value {
  color: #7cb0ff;
}

.summary-card.tone-green {
  border-left-color: var(--good);
}

.summary-card.tone-green .summary-value {
  color: #4ade80;
}

.summary-card.tone-purple {
  border-left-color: #8b5cf6;
}

.summary-card.tone-purple .summary-value {
  color: #c4b5fd;
}

.summary-card.tone-gold {
  border-left-color: var(--gold);
}

.summary-card.tone-gold .summary-value {
  color: var(--gold);
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 6px;
}

/* Dossier permanent : axes des pieces, notes et depot de fichier en ligne. */
.axis-tabs {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.note-block {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-3);
  line-height: 1.5;
}

.inline-upload {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inline-upload input[type="file"] {
  width: 128px;
  min-height: 25px;
  padding: 2px 4px;
}

.badge.stat-gold {
  color: #fde8c3;
  border-color: rgba(209, 168, 75, 0.75);
  background: #2b2110;
}

/* Portefeuille : statistiques compactes puis tableau clients. */
.portfolio-table td .muted {
  margin-top: 2px;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.portfolio-stat {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.portfolio-stat strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
}

.portfolio-stat span {
  color: var(--muted);
}

.portfolio-stat.tone-green {
  border-left-color: var(--good);
}

.portfolio-stat.tone-green strong {
  color: #4ade80;
}

.portfolio-stat.tone-blue {
  border-left-color: var(--accent);
}

.portfolio-stat.tone-blue strong {
  color: #7cb0ff;
}

.portfolio-stat.tone-red {
  border-left-color: var(--danger);
}

.portfolio-stat.tone-red strong {
  color: #fca5a5;
}

.portfolio-stat.tone-gold {
  border-left-color: var(--gold);
}

.portfolio-stat.tone-gold strong {
  color: var(--gold);
}

.filters.wide {
  grid-template-columns: 180px 180px auto;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 22px;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(3px);
}

.modal-window {
  width: min(100%, 980px);
  max-height: calc(100vh - 68px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid #3b4656;
  border-radius: 6px;
  background: #171c24;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.modal-window.small {
  width: min(100%, 520px);
}

.modal-window.medium {
  width: min(100%, 760px);
}

.modal-window.wide {
  width: min(100%, 1060px);
}

.modal-window.fullscreen {
  width: min(100%, 1280px);
  max-height: calc(100vh - 36px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #10151d;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-head p {
  margin: 2px 0 0;
  color: var(--muted);
}

.modal-close {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  background: #222833;
  font-weight: 700;
  white-space: nowrap;
}

.modal-close:hover {
  background: #2a3342;
}

.modal-body {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.modal-body > .notice:last-child,
.modal-body > form:last-child {
  margin-bottom: 0;
}

.modal-body .panel-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.report {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px;
  color: #111827;
  background: #fff;
}

.report h1,
.report h2,
.report h3 {
  color: #111827;
}

@media (max-width: 1280px) {
  .finance-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .finance-bar .actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .main,
  .worksplit,
  .worksplit.narrow,
  .home-panels,
  .follow-grid {
    grid-template-columns: 1fr;
  }

  .modules {
    display: none;
  }

  .filters,
  .metric-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .finance-bar,
  .finance-bar.empty {
    grid-template-columns: 1fr;
  }

  .client-identity {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
