:root {
  color-scheme: light;

  /* Neutres - typographie & surfaces */
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-strong: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --soft: #f1f5f9;
  --softer: #f8fafc;

  /* Marque - bleu marine industriel */
  --nav: #0a1929;
  --nav-hover: #132f4c;
  --nav-line: rgba(255, 255, 255, 0.08);
  --primary: #1e3a5f;
  --primary-hover: #16314f;
  --blue: #1e3a5f;

  /* Accent - ambre industriel */
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fed7aa;
  --accent-bg: #fff7ed;
  --teal: #c2410c;

  /* Status */
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;

  /* Effets */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --radius-lg: 12px;

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
}

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

.api-sync-banner {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  color: #9f1239;
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
}

.api-sync-banner.hidden {
  display: none;
}

.api-sync-banner .api-sync-inner strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.api-sync-banner .api-sync-inner p {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 0.85rem;
  white-space: pre-wrap;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--nav-line);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  border-radius: 6px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: #fff;
}

.brand span {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-foot span,
.sidebar-foot small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.sidebar-foot small {
  display: block;
  margin-top: 10px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 14px 6px;
}

.nav-item {
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  padding: 9px 14px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}

.nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.intranet-nav:not(.active)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(194, 65, 12, 0.5);
  border-radius: 2px;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 18px;
}

.logout-btn {
  margin-top: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dbe4ec;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Page de connexion */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at top left, rgba(194, 65, 12, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(30, 58, 95, 0.15) 0%, transparent 60%),
    linear-gradient(135deg, #0a1929 0%, #132f4c 100%);
  padding: 24px;
  position: relative;
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 38px 34px 28px;
  width: 100%;
  max-width: 380px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.auth-card .auth-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.auth-card label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink);
}

.auth-card label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.auth-card button {
  width: 100%;
  background: var(--nav);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s ease;
}

.auth-card button:hover {
  background: var(--nav-hover);
}

.auth-card button:disabled {
  background: var(--muted);
  cursor: not-allowed;
}

.auth-error {
  background: var(--red-bg);
  border: 1px solid rgba(185, 28, 28, 0.25);
  color: var(--red);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

main {
  padding: 26px 30px;
  overflow: hidden;
  background: var(--softer);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.panel-head,
.dialog-head,
.dialog-actions,
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
  margin: 0 2px;
}

.ghost-button-sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--muted-strong);
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  color: var(--muted-strong);
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 2px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 26px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.compact-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.ghost-button:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.danger-button {
  color: #fff;
  background: var(--red);
}

.danger-button:hover {
  background: #991b1b;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--muted-strong);
}

.icon-button:hover {
  background: var(--soft);
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
  margin: 22px 0 18px;
}

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.metrics article {
  padding: 16px 18px;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.metrics article:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.metrics article.metric-link {
  cursor: pointer;
}

.metrics article.metric-link:focus-visible {
  outline: 3px solid rgba(18, 82, 142, 0.25);
  outline-offset: 3px;
}

.metrics article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  opacity: 0.7;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metrics .metric-breakdown {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px 180px;
  gap: 12px;
  margin-bottom: 16px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 13.5px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

input::placeholder {
  color: #94a3b8;
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 132px;
}

select[multiple] option {
  padding: 5px 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 16px;
}

.services-only {
  display: none;
}

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

.services-focus .services-only {
  display: block;
}

.services-focus .dashboard-only {
  display: none;
}

.service-guide-panel {
  border-left: 4px solid var(--primary);
}

.service-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.service-guide article {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--softer);
  padding: 14px;
}

.service-guide strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 6px;
}

.service-guide span {
  display: block;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
}

/* Vue intranet — acces comptes / portails */
.intranet-page {
  max-width: 1100px;
  margin: 0 auto;
}

.intranet-hero {
  background: linear-gradient(135deg, #0a1929 0%, #132f4c 60%, #1e3a5f 100%);
  color: #f4f8fb;
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.intranet-hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 240px;
  height: 100%;
  background: radial-gradient(circle at right, rgba(194, 65, 12, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.intranet-hero .eyebrow {
  color: #fdba74;
}

.intranet-hero-title {
  font-size: 1.35rem;
  font-weight: 750;
  margin: 0.25rem 0 0.5rem;
  letter-spacing: -0.02em;
}

.intranet-hero-lead {
  margin: 0;
  max-width: 42rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(230, 240, 245, 0.92);
}

.intranet-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(160px, 220px);
  gap: 12px;
  margin-bottom: 1.25rem;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(20, 32, 45, 0.06);
}

.intranet-toolbar .search-field {
  min-width: 0;
}

.portals-by-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.portal-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1rem 1.15rem;
  box-shadow: 0 4px 18px rgba(20, 32, 45, 0.05);
}

.portal-section-title {
  margin: 0 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-strong);
}

.portal-section-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: middle;
  transform: translateY(-1px);
}

.portals-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, var(--surface) 100%);
  min-height: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-card:hover {
  border-color: #c5d7e8;
  box-shadow: 0 10px 28px rgba(20, 32, 45, 0.08);
}

.portal-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.portal-card-vendor {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--soft);
  padding: 4px 8px;
  border-radius: 6px;
}

.portal-card-edit {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.portal-card-edit:hover {
  border-color: #b8c6d4;
  background: var(--soft);
}

.portal-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
}

.portal-card-login {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
}

.portal-card-login-label {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 6px;
}

.portal-card-desc {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.portal-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

.portal-card-actions .primary-button {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* Vue presentation — outil et contact */
.about-page {
  max-width: 1120px;
  margin: 0 auto;
}

.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 20px;
  align-items: stretch;
  background: linear-gradient(135deg, #0a1929 0%, #122b46 55%, #1e3a5f 100%);
  color: #f8fafc;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.about-hero .eyebrow {
  color: #fdba74;
}

.about-hero h2 {
  max-width: 760px;
  margin: 0.35rem 0 0.9rem;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.about-hero p,
.about-panel p,
.about-grid p {
  margin: 0;
  color: rgba(241, 245, 249, 0.84);
  line-height: 1.6;
}

.about-contact-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.about-contact-card span,
.about-contact-card small {
  color: rgba(241, 245, 249, 0.78);
  line-height: 1.45;
}

.about-contact-card a {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.about-contact-card a:hover {
  text-decoration: underline;
}

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

.about-grid article,
.about-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.about-grid article {
  padding: 18px;
}

.about-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1rem;
}

.about-grid p,
.about-panel p {
  color: var(--muted-strong);
}

.about-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  margin-top: 18px;
  padding: 22px;
}

.about-panel h3 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.panel {
  min-width: 0;
  padding: 18px 20px;
}

.panel.wide {
  grid-column: span 1;
}

/* Quand le panneau wide est seul dans sa section, qu'il prenne toute la largeur */
.content-grid > .panel.wide:only-child {
  grid-column: 1 / -1;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  margin: 14px -20px -18px;
  border-top: 1px solid var(--line);
}

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

th,
td {
  padding: 12px 20px;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13.5px;
}

thead th {
  border-top: 0;
  background: var(--softer);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 10px;
  padding-bottom: 10px;
}

tbody tr {
  transition: background 0.1s ease;
}

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

td strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge.active {
  color: var(--green);
  background: var(--green-bg);
  border-color: rgba(21, 128, 61, 0.2);
}

.badge.soon {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: rgba(180, 83, 9, 0.25);
}

.badge.expired {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(185, 28, 28, 0.25);
}

.row-action {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 6px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-strong);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, opacity 0.15s ease;
}

.row-action:hover {
  background: var(--soft);
  border-color: var(--muted);
  color: var(--ink);
}

/* Le bouton Ouvrir n'apparait qu'au survol de la ligne pour alleger le visuel */
tbody tr .row-action {
  opacity: 0.35;
}

tbody tr:hover .row-action,
tbody tr:focus-within .row-action {
  opacity: 1;
}

/* Cellule expiration : pile date / sous-titre / tag de renouvellement */
.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.cell-renewal {
  display: inline-block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.cell-renewal-auto {
  color: var(--green);
  background: var(--green-bg);
  border-color: rgba(21, 128, 61, 0.18);
}

.cell-renewal-manual {
  color: var(--muted-strong);
  background: var(--soft);
  border-color: var(--line-strong);
}

.alert-list,
.expense-list,
.breakdown {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.alert-item,
.expense-item,
.bar-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  transition: border-color 0.12s ease, background 0.12s ease;
  position: relative;
}

.alert-item:hover,
.expense-item:hover {
  border-color: var(--line-strong);
  background: var(--softer);
}

.alert-item {
  padding-left: 16px;
  border-left: 3px solid var(--amber);
}

.alert-item.critical {
  border-left-color: var(--red);
  background: linear-gradient(90deg, var(--red-bg) 0%, var(--surface) 30%);
}

.alert-item strong,
.expense-item strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
}

.alert-item span,
.expense-item span,
.bar-row span {
  color: var(--muted);
  font-size: 12.5px;
}

.bar-track {
  height: 8px;
  background: var(--soft);
  border-radius: 99px;
  margin-top: 9px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: inherit;
}

.hidden {
  display: none;
}

dialog {
  border: 0;
  border-radius: var(--radius-lg);
  width: min(840px, calc(100vw - 24px));
  padding: 0;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(10, 25, 41, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--softer);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dialog-head h2 {
  font-size: 17px;
  font-weight: 700;
}

form {
  padding: 20px;
}

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

.span-2 {
  grid-column: span 2;
}

.form-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.form-hint strong {
  color: var(--ink);
  font-weight: 650;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.dialog-actions > div {
  display: flex;
  gap: 10px;
}

.app-signature {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.app-signature strong {
  display: block;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 13px;
}

.app-signature span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

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

.contracts-view-hint {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 4px;
}

.contracts-view-hint strong {
  color: var(--ink);
  font-weight: 650;
}

.contracts-by-type {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.reference-quality-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: stretch;
}

.reference-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.reference-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--softer);
  border-bottom: 1px solid var(--line);
}

.reference-card-head span {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reference-card-head strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.reference-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reference-card-head .reference-add-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--primary);
  font-weight: 700;
}

.reference-card-head .reference-add-button:hover,
.reference-card-head .reference-add-button:focus {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.reference-card-issues.is-clean .reference-card-head strong {
  color: var(--green);
}

.reference-card ul {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.reference-card li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.reference-card li:first-child {
  border-top: 0;
}

.reference-card li span {
  color: var(--ink);
  font-weight: 650;
  min-width: 0;
  overflow-wrap: anywhere;
}

.reference-card li strong {
  color: var(--muted-strong);
  font-size: 12px;
}

.reference-card li small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.4;
}

.reference-card-contracts .row-action {
  grid-column: 2;
  justify-self: end;
}

.reference-card-issues li {
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Etat vide propre pour "Aucun point bloqueur" */
.reference-card-issues .reference-ok {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  color: var(--green);
  font-weight: 600;
}

.reference-card-issues .reference-ok-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  background: var(--green-bg);
  border: 1px solid rgba(21, 128, 61, 0.25);
  border-radius: 50%;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

/* Boutons "Modifier" / "Corriger" dans les cartes de la vue Contrats : plus discrets */
.reference-card .row-action {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
  min-height: 26px;
  padding: 0 8px;
}

.reference-card li:hover .row-action,
.reference-card .row-action:focus {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.reference-card-issues .row-action {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.reference-empty,
.reference-ok {
  display: block !important;
  color: var(--muted);
  font-style: italic;
}

.contract-type-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.contract-type-head {
  padding: 12px 16px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  font-weight: 750;
  font-size: 15px;
}

.contract-type-head span {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.contract-sub {
  border-bottom: 1px solid var(--line);
}

.contract-sub:last-child {
  border-bottom: none;
}

.contract-sub-head {
  padding: 10px 16px;
  background: #fafcfd;
  border-bottom: 1px solid var(--line);
}

.contract-sub-head strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.contract-sub .table-wrap {
  margin: 0;
}

.contract-sub table {
  min-width: 640px;
}

.form-grid .inline-checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 500;
}

.form-grid .inline-checkbox input {
  margin-top: 3px;
  flex-shrink: 0;
}

.asset-budget-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.contract-sub-head-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contract-invoice-meta {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}

.contract-invoice-meta strong {
  color: var(--ink);
  font-weight: 650;
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar-actions,
  .toolbar,
  dialog {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  main {
    padding: 0;
    overflow: visible;
  }

  .content-grid,
  .metrics {
    break-inside: avoid;
  }

  .panel,
  .metrics article {
    box-shadow: none;
  }

  .app-signature {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 8px;
    background: #fff;
  }
}

@media (max-width: 1100px) {
  .reference-quality-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .reference-quality-grid {
    grid-template-columns: 1fr;
  }
}

/* auto-fit gere deja le responsive de la grille metrics */

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 14px 16px;
  }

  .brand {
    padding-bottom: 12px;
  }

  nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto;
  }

  .nav-section {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-section-title {
    display: none;
  }

  .sidebar-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    margin-top: 4px;
    padding-top: 12px;
  }

  .sidebar-foot span,
  .sidebar-foot strong {
    display: none;
  }

  .sidebar-foot small {
    margin-top: 0;
    font-size: 11px;
    line-height: 1.3;
  }

  .logout-btn {
    margin-top: 0;
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
  }

  .metrics,
  .toolbar,
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }

  .about-hero,
  .about-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  main {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .toolbar,
  .content-grid,
  .form-grid,
  .about-grid,
  .intranet-toolbar {
    grid-template-columns: 1fr;
  }

  .about-hero {
    padding: 22px;
  }

  .span-2 {
    grid-column: span 1;
  }
}

/* Referentiels — page Fournisseurs & sites */
.panel-subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.suppliers-manage-grid {
  align-items: start;
}

.reference-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.ref-manage-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.ref-manage-main strong {
  display: block;
  font-size: 1rem;
}

.ref-manage-meta {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.ref-manage-empty {
  margin: 0;
  line-height: 1.5;
}

.field-hint {
  display: block;
  margin: 4px 0 6px;
  line-height: 1.45;
  font-weight: 500;
}

.danger-text-button:not(:disabled) {
  color: var(--red);
  border-color: #f0c4c4;
}

.danger-text-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
