@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/montserrat-alternates-latin-500-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/montserrat-alternates-latin-600-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat Alternates";
  src: url("fonts/montserrat-alternates-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 1000;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --ink: #020b42;
  --canvas: #f3f5fa;
  --surface: #ffffff;
  --muted: #6b7194;
  --line: rgba(2, 11, 66, 0.08);
  --yellow: #13f5bb;
  --yellow-hover: #0fd9a5;
  --yellow-soft: #d4fbef;
  --on-yellow: #020b42;
  --st-draft-bg: #e6e6e3;
  --st-draft-fg: #43474b;
  --st-progress-bg: #dbe5ec;
  --st-progress-fg: #2b5470;
  --st-pending-bg: #f2e4c6;
  --st-pending-fg: #7d5200;
  --st-done-bg: #dbe6d9;
  --st-done-fg: #36623f;
  --st-alert-bg: #f3d8cf;
  --st-alert-fg: #9a3522;
  --focus-ring: 0 0 0 4px var(--yellow-soft);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --shadow-1: 0 1px 2px rgba(2, 11, 66, 0.06);
  --shadow-2: 0 8px 24px rgba(2, 11, 66, 0.08);
  --shadow-3: 0 24px 64px rgba(2, 11, 66, 0.14);
  --font-heading: "Montserrat Alternates", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-page: 34px;
  --leading-page: 40px;
  --text-page-mobile: 30px;
  --leading-page-mobile: 36px;
  --text-kpi: 32px;
  --leading-kpi: 36px;
  --text-section: 22px;
  --leading-section: 28px;
  --text-card: 17px;
  --leading-card: 24px;
  --text-body: 15px;
  --leading-body: 22px;
  --text-table: 14px;
  --leading-table: 20px;
  --text-label: 14px;
  --text-meta: 13px;
  --leading-meta: 18px;
  --text-overline: 12px;
  --leading-overline: 16px;
  --sidebar-width: 248px;
  --topbar-height: 72px;
  --control-height: 44px;
  --button-height: 40px;
  --table-row-height: 52px;
  --motion-fast: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --motion-panel: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Compatibilite temporaire des composants historiques. */
  --font: var(--font-body);
  --blue: var(--yellow);
  --blue-soft: var(--yellow-soft);
  --green: var(--st-done-fg);
  --green-soft: var(--st-done-bg);
  --amber: var(--st-pending-fg);
  --amber-soft: var(--st-pending-bg);
  --red: var(--st-alert-fg);
  --red-soft: var(--st-alert-bg);
  --radius: var(--r-lg);
  --shadow: var(--shadow-2);
}

body.backoffice[data-dashboard-theme="dark"] {
  --ink: #f1f3f9;
  --canvas: #060c2e;
  --surface: #0a1238;
  --muted: #959bb6;
  --line: rgba(255, 255, 255, 0.08);
  --yellow-soft: #3a3016;
  --st-draft-bg: rgba(174, 178, 181, 0.18);
  --st-draft-fg: #d6dadd;
  --st-progress-bg: rgba(99, 145, 176, 0.18);
  --st-progress-fg: #a9cce2;
  --st-pending-bg: rgba(187, 132, 28, 0.18);
  --st-pending-fg: #f0cf88;
  --st-done-bg: rgba(91, 137, 99, 0.18);
  --st-done-fg: #a8d0ae;
  --st-alert-bg: rgba(182, 78, 57, 0.18);
  --st-alert-fg: #efaa9c;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.24);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  body.backoffice[data-dashboard-theme="system"] {
    --ink: #f1f3f9;
    --canvas: #060c2e;
    --surface: #0a1238;
    --muted: #959bb6;
    --line: rgba(255, 255, 255, 0.08);
    --yellow-soft: #3a3016;
    --st-draft-bg: rgba(174, 178, 181, 0.18);
    --st-draft-fg: #d6dadd;
    --st-progress-bg: rgba(99, 145, 176, 0.18);
    --st-progress-fg: #a9cce2;
    --st-pending-bg: rgba(187, 132, 28, 0.18);
    --st-pending-fg: #f0cf88;
    --st-done-bg: rgba(91, 137, 99, 0.18);
    --st-done-fg: #a8d0ae;
    --st-alert-bg: rgba(182, 78, 57, 0.18);
    --st-alert-fg: #efaa9c;
    color-scheme: dark;
  }
}

body.backoffice {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

body.backoffice *,
body.backoffice *::before,
body.backoffice *::after {
  box-sizing: border-box;
}

body.backoffice :where(button, input, select, textarea) {
  font-family: var(--font-body);
}

body.backoffice :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

body.backoffice :where(.metric-value, .amount, time, [data-numeric]) {
  font-variant-numeric: tabular-nums;
}

body.backoffice .app {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

body.backoffice .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: var(--space-5) var(--space-4);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  backdrop-filter: none;
}

body.backoffice .main {
  grid-column: 2;
}

body.backoffice .sidebar .brand {
  min-height: var(--space-7);
  padding: 0 var(--space-3) var(--space-5);
  gap: var(--space-3);
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 900;
}

body.backoffice .brand-mark:not(.has-logo) {
  position: relative;
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-heading);
  font-weight: 900;
}

body.backoffice .brand-mark:not(.has-logo)::after {
  content: "";
  position: absolute;
  right: calc(var(--space-1) * -0.5);
  bottom: calc(var(--space-1) * -0.5);
  width: var(--space-3);
  height: var(--space-3);
  border: var(--space-1) solid var(--surface);
  border-radius: var(--r-full);
  background: var(--yellow);
}

body.backoffice .nav-label {
  padding: var(--space-5) var(--space-3) var(--space-2);
  color: var(--muted);
  font-size: var(--text-overline);
  line-height: var(--leading-overline);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body.backoffice .nav-item.has-storage-alert {
  position: relative;
}

body.backoffice .nav-item.has-storage-alert::after {
  content: "";
  width: var(--space-2);
  height: var(--space-2);
  margin-left: auto;
  border-radius: var(--r-full);
  background: var(--st-alert-fg);
}

body.backoffice .storage-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--st-pending-fg);
  border-radius: var(--r-md);
  background: var(--st-pending-bg);
  color: var(--st-pending-fg);
}

body.backoffice .storage-banner.critical {
  border-color: var(--st-alert-fg);
  background: var(--st-alert-bg);
  color: var(--st-alert-fg);
}

body.backoffice .storage-banner > div {
  display: grid;
  flex: 1;
  gap: var(--space-1);
}

body.backoffice .storage-banner-icon {
  display: grid;
  width: var(--space-6);
  height: var(--space-6);
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--r-full);
  background: currentColor;
  color: var(--surface);
  font-family: var(--font-heading);
  font-weight: 900;
}

body.backoffice .usage-card small {
  display: block;
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice .usage-card.critical .progress i {
  background: var(--st-alert-fg);
}

body.backoffice .retention-request {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}

body.backoffice .retention-request:last-child {
  border-bottom: 0;
}

body.backoffice .project-workspace-nav {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
}

body.backoffice .project-tabs {
  display: block;
}

body.backoffice .project-workspace-nav button {
  min-height: var(--button-height);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-label);
  font-weight: 700;
  white-space: nowrap;
}

body.backoffice .project-workspace-nav button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

body.backoffice .project-tabs > .detail-section {
  margin-top: var(--space-4);
}

body.backoffice .project-folder {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

body.backoffice .project-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-2);
  color: var(--muted);
  font-size: var(--text-meta);
}

body.backoffice .project-overview-time {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

body.backoffice .nav-item {
  min-height: var(--button-height);
  margin: 0 0 var(--space-1);
  padding: 0 var(--space-3);
  gap: var(--space-3);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--text-label);
  font-weight: 600;
  transition: color var(--motion-fast), background var(--motion-fast);
}

body.backoffice .nav-item:hover {
  background: var(--canvas);
  color: var(--ink);
}

body.backoffice .nav-item.active {
  background: var(--yellow-soft);
  color: var(--ink);
  box-shadow: none;
  font-weight: 700;
}

body.backoffice .nav-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  flex: 0 0 20px;
}

body.backoffice .nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.backoffice .sidebar-bottom {
  padding: var(--space-5) var(--space-2) 0;
}

body.backoffice .user-chip {
  gap: var(--space-3);
}

body.backoffice .avatar {
  border-radius: var(--r-full);
  background: var(--ink);
  color: var(--surface);
}

body.backoffice .user-meta strong {
  font-size: var(--text-label);
  line-height: var(--leading-table);
  font-weight: 700;
}

body.backoffice .user-meta span,
body.backoffice .saas-credit small,
body.backoffice .logout-link {
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice .logout-link,
body.backoffice .saas-credit {
  border-radius: var(--r-sm);
  transition: color var(--motion-fast), background var(--motion-fast);
}

/* Refinements — administration, workspace and full project pages */
body.backoffice .brand-logo-only{width:100%;min-height:70px;justify-content:flex-start;padding:8px 4px}
body.backoffice .brand-logo-only .brand-mark{width:100%;height:54px;background:transparent;border-radius:0;box-shadow:none;justify-content:flex-start;color:var(--ink);font-size:28px}
body.backoffice .brand-logo-only .brand-mark img{width:100%;height:100%;max-width:176px;object-fit:contain;object-position:left center}
body.backoffice .login-card .brand-logo-only{justify-content:center}
body.backoffice .login-card .brand-logo-only .brand-mark{justify-content:center}
body.backoffice .login-card .brand-logo-only .brand-mark img{object-position:center;max-width:190px}
body.backoffice .profile-menu-button{border:0;background:transparent;color:var(--muted);display:flex;align-items:center;gap:5px;padding:6px;font:inherit;font-size:12px;font-weight:800;cursor:pointer;border-radius:8px}
body.backoffice .profile-menu-button:hover{background:var(--surface-2);color:var(--ink)}
body.backoffice .user-chip .profile-menu-button span:first-child{display:none}
body.backoffice .app-footer{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:42px;padding:24px 0 4px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}
body.backoffice .app-footer .saas-credit{position:static;width:auto;border:0;padding:0;background:transparent;display:flex!important}
body.backoffice .app-footer .saas-credit span{width:28px;height:28px}
body.backoffice .card:not(.knowledge-card),body.backoffice .metric,body.backoffice .usage-card,body.backoffice .site-card{transform:none!important}
body.backoffice .metric:hover,body.backoffice .usage-card:hover,body.backoffice .site-card:hover{box-shadow:var(--shadow-sm)!important;border-color:var(--line)!important}
body.backoffice .health-dot{width:10px;height:10px;border-radius:50%;background:#e7a625;box-shadow:0 0 0 4px rgba(231,166,37,.12);flex:0 0 auto}
body.backoffice .health-dot.ok{background:#2f9b62;box-shadow:0 0 0 4px rgba(47,155,98,.12)}
body.backoffice .brand-assets{display:grid;gap:16px;margin-top:18px}
body.backoffice .asset-field>label{display:block;margin-bottom:8px;font-size:12px;font-weight:800;color:var(--ink)}
body.backoffice .asset-picker{grid-template-columns:100px minmax(0,1fr) auto}
body.backoffice .dark-preview{background:#020b42;padding:12px;border-radius:14px;color:white}
body.backoffice .favicon-preview{width:56px!important;height:56px!important;border-radius:12px!important}
body.backoffice .connection-status{margin-top:14px;padding:11px 13px;border-radius:10px;background:var(--surface-2);font-size:13px;font-weight:700}
body.backoffice .connection-status.success{background:#eaf8ef;color:#237b4b}
body.backoffice .connection-status.error{background:#fff0ef;color:#a93c35}
body.backoffice .audit-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:18px}
body.backoffice .audit-summary article{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px;display:grid;gap:4px}
body.backoffice .audit-summary strong{font-size:28px;line-height:1;color:var(--ink)}
body.backoffice .audit-summary span{font-size:12px;color:var(--muted)}
body.backoffice .audit-action{display:flex;align-items:center;gap:11px}
body.backoffice .audit-icon{width:10px;height:10px;border-radius:50%;background:#8e98a5;flex:0 0 auto}
body.backoffice .audit-icon.security{background:#8156d8}.audit-icon.access{background:#287bbd}.audit-icon.billing{background:#2f9b62}.audit-icon.attention{box-shadow:0 0 0 5px rgba(196,68,58,.14);background:#c4443a}
body.backoffice .support-meta{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}
body.backoffice .support-meta span{background:var(--surface-2);border-radius:999px;padding:6px 9px;font-size:12px;color:var(--muted)}
body.backoffice .support-detail-copy>p{font-size:15px;line-height:1.7;white-space:pre-wrap;margin-bottom:22px}
body.backoffice .attachment-card{display:flex;align-items:center;gap:12px;border:1px solid var(--line);border-radius:12px;padding:12px;text-decoration:none;color:var(--ink)}
body.backoffice .attachment-card div{display:grid}.attachment-card small{color:var(--muted)}
body.backoffice .priority{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.06em}.priority.high,.priority.urgent{color:#b84137}.priority.low{color:var(--muted)}
body.backoffice .subscription-overview>div{align-content:start}
body.backoffice .subscription-overview .badge{display:inline-flex;width:auto;justify-self:start;align-self:start}
body.backoffice .back-link{border:0;background:transparent;padding:0;margin:3px 0 24px;color:var(--muted);font-weight:800;cursor:pointer}
body.backoffice .project-page-hero{margin-bottom:18px}
body.backoffice .project-page-hero .badge{vertical-align:middle;margin-right:9px}.project-deadline{font-size:13px;color:var(--muted)}
body.backoffice .project-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}
body.backoffice .project-kpis article{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:17px;display:grid;gap:7px}
body.backoffice .project-kpis span{font-size:12px;color:var(--muted)}.project-kpis strong{font-size:22px;color:var(--ink)}
body.backoffice .project-page-grid{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(330px,.75fr);gap:16px}
body.backoffice .project-folders{padding:0 18px 18px;display:grid;gap:10px}
body.backoffice .project-folder{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface)}
body.backoffice .project-folder>summary{display:flex;justify-content:space-between;padding:13px 15px;font-size:13px;font-weight:800;cursor:pointer;background:var(--surface-2)}
body.backoffice .project-file-row{display:flex;align-items:center;gap:11px;padding:11px 14px;border-top:1px solid var(--line)}
body.backoffice .file-type-icon{font-size:9px;font-weight:900;border-radius:6px;padding:5px;background:#fff1cc;color:#8a6000}
body.backoffice .calendar-legend{display:flex;gap:18px;flex-wrap:wrap;margin:4px 0 14px;color:var(--muted);font-size:12px}
body.backoffice .calendar-legend span{display:flex;align-items:center;gap:6px}.calendar-legend i{width:9px;height:9px;border-radius:3px;background:#7b8fb8}.calendar-legend i.task{background:#e1a32a}.calendar-legend i.deadline{background:#b268c4}
body.backoffice .knowledge-grid{grid-template-columns:repeat(auto-fill,minmax(270px,1fr))}
body.backoffice .knowledge-card{padding:0!important;overflow:hidden;text-align:left;cursor:default}
body.backoffice .knowledge-paper-preview{padding:24px;min-height:230px;background:#fff}
body.backoffice .knowledge-letterhead{height:34px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);margin-bottom:22px;padding-bottom:9px;font-size:10px;color:var(--muted)}
body.backoffice .knowledge-letterhead img{max-height:22px;max-width:100px;object-fit:contain}
body.backoffice .knowledge-card-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;background:var(--surface-2);border-top:1px solid var(--line)}
body.backoffice .knowledge-a4{width:min(100%,740px);min-height:760px;margin:0 auto;background:white;border:1px solid var(--line);box-shadow:0 18px 55px rgba(2, 11, 66,.08);padding:58px 64px}
body.backoffice .knowledge-a4-brand{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line);padding-bottom:18px;margin-bottom:42px;color:var(--muted);font-size:12px}.knowledge-a4-brand img{max-height:38px;max-width:170px;object-fit:contain}
body.backoffice .knowledge-a4 .rich-editor{border:0;padding:0;min-height:560px}
body.backoffice .site-grid{grid-template-columns:repeat(2,minmax(0,1fr))}

@media(max-width:980px){body.backoffice .project-page-grid,body.backoffice .site-grid{grid-template-columns:1fr}body.backoffice .project-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){body.backoffice .audit-summary{grid-template-columns:1fr}body.backoffice .project-kpis{grid-template-columns:1fr 1fr}body.backoffice .project-file-row{flex-wrap:wrap}body.backoffice .knowledge-a4{padding:30px 24px}.app-footer{padding-bottom:78px!important}}

body.backoffice .logout-link:hover {
  background: var(--st-alert-bg);
  color: var(--st-alert-fg);
}

body.backoffice .topbar {
  height: var(--topbar-height);
  padding: 0 var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}

body.backoffice .topbar h2 {
  font-family: var(--font-body);
  font-size: var(--text-card);
  line-height: var(--leading-card);
  font-weight: 800;
  letter-spacing: 0;
}

body.backoffice .top-actions,
body.backoffice .hero-actions,
body.backoffice .toolbar,
body.backoffice .modal-actions,
body.backoffice .row-actions {
  gap: var(--space-2);
}

body.backoffice .content {
  max-width: 1440px;
  padding: var(--space-6);
}

body.backoffice .hero {
  margin-bottom: var(--space-5);
  gap: var(--space-5);
}

body.backoffice .hero h1,
body.backoffice .login-card h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: var(--text-page);
  line-height: var(--leading-page);
  font-weight: 900;
  letter-spacing: -0.025em;
}

body.backoffice .hero p {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

body.backoffice .eyebrow {
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: var(--text-overline);
  line-height: var(--leading-overline);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body.backoffice :where(.work-section-heading h3, .legacy-section-head h2) {
  font-family: var(--font-heading);
  font-size: var(--text-section);
  line-height: var(--leading-section);
  font-weight: 800;
  letter-spacing: -0.015em;
}

body.backoffice :where(.card-head h3, .profile-security h4, .detail-grid h4, .detail-files h4) {
  font-family: var(--font-body);
  font-size: var(--text-card);
  line-height: var(--leading-card);
  font-weight: 800;
  letter-spacing: 0;
}

body.backoffice :where(.card-subtitle, .metric-note, .field-help, .hero-date, .muted-small) {
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice :where(.metrics, .grid-2, .grid-dashboard, .site-grid, .plans-grid, .branding-grid, .settings-grid, .subscription-overview) {
  gap: var(--space-4);
}

body.backoffice .card,
body.backoffice .metric,
body.backoffice .site-card,
body.backoffice .plan-card,
body.backoffice .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  backdrop-filter: none;
}

body.backoffice .card,
body.backoffice .site-card,
body.backoffice .plan-card {
  transition: box-shadow var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}

body.backoffice :where(.site-card, .plan-card):hover {
  box-shadow: var(--shadow-2);
}

body.backoffice .metric {
  padding: var(--space-5);
}

body.backoffice .metric-top {
  color: var(--muted);
  font-size: var(--text-overline);
  line-height: var(--leading-overline);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.backoffice .metric .metric-icon {
  display: none;
}

body.backoffice .metric-value {
  margin: var(--space-3) 0 var(--space-1);
  font-family: var(--font-heading);
  font-size: var(--text-kpi);
  line-height: var(--leading-kpi);
  font-weight: 900;
  letter-spacing: -0.02em;
}

body.backoffice .card-head {
  min-height: var(--table-row-height);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  gap: var(--space-4);
}

body.backoffice .card-body,
body.backoffice .modal-body {
  padding: var(--space-5);
}

body.backoffice .btn {
  min-height: var(--button-height);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--text-label);
  line-height: var(--leading-table);
  font-weight: 700;
  transform: none;
  box-shadow: none;
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}

body.backoffice .btn:hover {
  transform: none;
}

body.backoffice .btn-primary {
  background: var(--yellow);
  color: var(--on-yellow);
}

body.backoffice .btn-primary:hover {
  background: var(--yellow-hover);
}

body.backoffice :where(.btn-secondary, .btn-dark) {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

body.backoffice :where(.btn-secondary, .btn-dark):hover {
  background: var(--canvas);
}

body.backoffice .btn-danger {
  background: var(--st-alert-bg);
  color: var(--st-alert-fg);
}

body.backoffice .btn-sm {
  min-height: var(--space-6);
  padding: 0 var(--space-3);
  border-radius: var(--r-sm);
  font-size: var(--text-meta);
}

body.backoffice .btn:disabled,
body.backoffice .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}

body.backoffice :where(.input, .select, .textarea) {
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}

body.backoffice .textarea {
  min-height: 104px;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

body.backoffice :where(.input, .select, .textarea):focus {
  border-color: var(--ink);
  box-shadow: var(--focus-ring);
}

body.backoffice .field {
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

body.backoffice .field label {
  color: var(--ink);
  font-size: var(--text-label);
  line-height: var(--leading-table);
  font-weight: 700;
}

body.backoffice .field-error,
body.backoffice .error-message {
  color: var(--st-alert-fg);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice .search .input,
body.backoffice .global-search .input {
  background: var(--surface);
}

body.backoffice .table {
  color: var(--ink);
  font-size: var(--text-table);
  line-height: var(--leading-table);
}

body.backoffice .table th {
  height: var(--control-height);
  padding: 0 var(--space-4);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-overline);
  line-height: var(--leading-overline);
  font-weight: 800;
  letter-spacing: 0.08em;
}

body.backoffice .table td {
  height: var(--table-row-height);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line);
}

body.backoffice .table tbody tr:hover {
  background: var(--canvas);
}

body.backoffice .table :where(.amount, [data-numeric]) {
  text-align: right;
}

body.backoffice .title-cell strong {
  font-weight: 600;
}

body.backoffice .title-cell span {
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice .badge {
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--r-sm);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
  font-weight: 700;
}

body.backoffice .badge::before {
  display: none;
}

body.backoffice .badge.gray {
  background: var(--st-draft-bg);
  color: var(--st-draft-fg);
}

body.backoffice .badge.blue {
  background: var(--st-progress-bg);
  color: var(--st-progress-fg);
}

body.backoffice .badge.amber {
  background: var(--st-pending-bg);
  color: var(--st-pending-fg);
}

body.backoffice .badge.green {
  background: var(--st-done-bg);
  color: var(--st-done-fg);
}

body.backoffice .badge.red {
  background: var(--st-alert-bg);
  color: var(--st-alert-fg);
}

body.backoffice .progress {
  background: var(--line);
  border-radius: var(--r-full);
}

body.backoffice .progress i {
  background: var(--st-progress-fg);
  border-radius: var(--r-full);
}

body.backoffice .notice,
body.backoffice .platform-notice {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--st-progress-bg);
  color: var(--st-progress-fg);
  font-size: var(--text-meta);
  line-height: var(--leading-meta);
}

body.backoffice .notice.private {
  background: var(--st-draft-bg);
  color: var(--st-draft-fg);
}

body.backoffice .subtle-notice {
  background: var(--surface);
  color: var(--muted);
}

body.backoffice .modal-backdrop,
body.backoffice .confirm-backdrop {
  background: rgba(2, 11, 66, 0.48);
  backdrop-filter: none;
}

body.backoffice .modal,
body.backoffice .confirm-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: nodema-panel-in var(--motion-panel);
}

body.backoffice .modal-head {
  padding: var(--space-4) var(--space-5);
}

body.backoffice .modal-head h3,
body.backoffice .confirm-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-section);
  line-height: var(--leading-section);
  font-weight: 800;
  letter-spacing: -0.015em;
}

body.backoffice .modal-actions {
  padding: var(--space-4) var(--space-5);
}

body.backoffice .dot-menu,
body.backoffice .icon-button {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

body.backoffice .dot-menu:hover,
body.backoffice .icon-button:hover {
  background: var(--canvas);
}

body.backoffice .toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--button-height);
  padding: var(--space-3) var(--space-4);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  transition: opacity var(--motion-fast), transform var(--motion-fast);
}

body.backoffice .toast-dot {
  width: var(--space-2);
  height: var(--space-2);
  flex: 0 0 var(--space-2);
  border-radius: var(--r-full);
  background: var(--st-progress-fg);
}

body.backoffice .toast[data-tone="success"] .toast-dot {
  background: var(--st-done-fg);
}

body.backoffice .toast[data-tone="warning"] .toast-dot {
  background: var(--st-pending-fg);
}

body.backoffice .toast[data-tone="error"] .toast-dot {
  background: var(--st-alert-fg);
}

body.backoffice .login-shell {
  padding: var(--space-5);
  background: var(--canvas);
}

body.backoffice .login-card {
  width: min(440px, 100%);
  padding: var(--space-6);
}

body.backoffice .login-card .brand {
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 900;
}

body.backoffice .login-card h1 {
  margin: var(--space-6) 0 var(--space-2);
}

body.backoffice .login-card > p {
  margin: 0 0 var(--space-5);
  color: var(--muted);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

body.backoffice .quick-actions {
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}

body.backoffice .quick-action {
  min-height: var(--button-height);
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: var(--text-label);
  font-weight: 700;
  transform: none;
}

body.backoffice .quick-action:hover {
  background: var(--canvas);
  transform: none;
}

body.backoffice .quick-action span {
  color: var(--ink);
}

body.backoffice :where(.site-stats div, .agency-summary div, .project-detail-head div, .site-chart-summary > div, .portal-summary-strip > div, .portal-traffic-kpis > div) {
  background: var(--canvas);
  border-radius: var(--r-sm);
}

body.backoffice :where(.search-results, .notification-popover) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  backdrop-filter: none;
}

body.backoffice .segmented {
  padding: var(--space-1);
  background: var(--st-draft-bg);
  border-radius: var(--r-md);
}

body.backoffice .segmented button {
  min-height: var(--space-6);
  border-radius: var(--r-sm);
  color: var(--st-draft-fg);
}

body.backoffice .segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

body.backoffice .calendar-day {
  background: var(--surface);
}

body.backoffice .calendar-day.today > strong {
  background: var(--yellow);
  color: var(--on-yellow);
}

body.backoffice .calendar-event,
body.backoffice .calendar-date-chip {
  background: var(--st-progress-bg);
  color: var(--st-progress-fg);
}

body.backoffice :where(.task-progress-ring, .site-line-chart circle) {
  color: var(--st-progress-fg);
}

body.backoffice .task-progress-ring {
  background: radial-gradient(circle at center, var(--surface) 58%, transparent 60%), conic-gradient(var(--st-progress-fg) var(--task-progress), var(--line) 0);
}

body.backoffice .site-line-chart circle {
  stroke: var(--st-progress-fg);
}

body.backoffice .traffic-bars i {
  background: var(--st-progress-fg);
}

body.backoffice .chart-column i {
  background: var(--st-progress-fg);
}

body.backoffice .site-line-chart polyline {
  stroke: var(--st-progress-fg);
}

body.backoffice .empty {
  padding: var(--space-7) var(--space-5);
  color: var(--muted);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

body.backoffice .empty strong {
  margin-bottom: var(--space-2);
  color: var(--ink);
  font-size: var(--text-card);
  line-height: var(--leading-card);
  font-weight: 800;
}

body.backoffice .empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  max-width: 520px;
  margin: auto;
  padding: var(--space-7) var(--space-5);
  text-align: center;
}

body.backoffice .empty-state svg {
  width: 200px;
  max-width: 100%;
  color: var(--ink);
}

body.backoffice .empty-state h3 {
  margin: 0;
  font-size: var(--text-card);
  line-height: var(--leading-card);
  font-weight: 800;
}

body.backoffice .empty-state p {
  max-width: 44ch;
  margin: 0;
  color: var(--muted);
}

body.backoffice .mobile-more-toggle,
body.backoffice .mobile-more-panel {
  display: none;
}

@keyframes nodema-panel-in {
  from { opacity: 0; transform: translateY(var(--space-2)) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) and (min-width: 901px) {
  body.backoffice .app {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  body.backoffice .sidebar {
    width: var(--sidebar-width);
    padding: var(--space-5) var(--space-4);
  }

  body.backoffice .sidebar .brand span,
  body.backoffice .nav-item span:not(.nav-icon),
  body.backoffice .nav-label,
  body.backoffice .sidebar-bottom .user-meta {
    display: initial;
  }

  body.backoffice .nav-item {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  body.backoffice .app {
    display: block;
  }

  body.backoffice .main {
    grid-column: auto;
  }

  body.backoffice .sidebar {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    height: auto;
    padding: var(--space-2) max(var(--space-2), env(safe-area-inset-right)) calc(var(--space-2) + env(safe-area-inset-bottom)) max(var(--space-2), env(safe-area-inset-left));
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: var(--shadow-2);
    z-index: 40;
  }

  body.backoffice .sidebar > .brand,
  body.backoffice .sidebar .nav-label,
  body.backoffice .sidebar-bottom {
    display: none;
  }

  body.backoffice .sidebar nav {
    display: grid;
    grid-template-columns: repeat(var(--tab-count, 5), minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }

  body.backoffice .sidebar .nav-item {
    display: none;
    min-width: 0;
    min-height: var(--space-7);
    padding: var(--space-1);
    margin: 0;
    gap: 0;
    justify-content: center;
    border-radius: var(--r-sm);
  }

  body.backoffice .sidebar .nav-item.mobile-primary,
  body.backoffice .sidebar .mobile-more-toggle {
    display: grid;
  }

  body.backoffice .sidebar .nav-item.mobile-primary {
    order: var(--tab-order, 0);
  }

  body.backoffice .sidebar .mobile-more-toggle {
    order: 99;
  }

  body.backoffice .sidebar .nav-item > span:not(.nav-icon),
  body.backoffice .sidebar .mobile-more-toggle > span:not(.nav-icon) {
    display: none;
  }

  body.backoffice .mobile-more-panel {
    position: fixed;
    right: var(--space-3);
    bottom: calc(var(--space-8) + var(--space-3) + env(safe-area-inset-bottom));
    left: var(--space-3);
    max-height: min(65vh, 520px);
    padding: var(--space-3);
    overflow: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    z-index: 39;
  }

  body.backoffice .mobile-more-panel.open {
    display: grid;
  }

  body.backoffice .mobile-more-panel .nav-item {
    display: flex;
    min-height: var(--button-height);
    padding: 0 var(--space-3);
    justify-content: flex-start;
  }

  body.backoffice .mobile-more-panel .nav-item > span:not(.nav-icon) {
    display: inline;
  }

  body.backoffice .mobile-more-panel .mobile-more-edit {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--button-height);
    margin-top: var(--space-1);
    padding: 0 var(--space-3);
    border: 1px dashed var(--line);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted);
    font-weight: 800;
  }

  body.backoffice .sidebar .nd-version-wrap {
    display: none;
  }

  body.backoffice .mobile-more-panel .mobile-more-version {
    margin-top: 0;
    border-style: solid;
    gap: 6px;
  }

  body.backoffice .mobile-more-panel .mobile-more-edit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.backoffice .content {
    padding: var(--space-5) var(--space-4) calc(var(--space-8) + var(--space-7));
  }

  body.backoffice .topbar {
    padding: 0 var(--space-4);
  }
}

@media (max-width: 640px) {
  body.backoffice .content {
    padding-inline: var(--space-4);
  }

  body.backoffice .card-head,
  body.backoffice .card-body,
  body.backoffice .metric,
  body.backoffice .site-card,
  body.backoffice .plan-card,
  body.backoffice .modal-body,
  body.backoffice .modal-actions {
    padding: var(--space-4);
  }

  body.backoffice .hero h1,
  body.backoffice .login-card h1 {
    font-size: var(--text-page-mobile);
    line-height: var(--leading-page-mobile);
  }

  body.backoffice .storage-banner,
  body.backoffice .retention-request {
    align-items: flex-start;
    flex-direction: column;
  }

  body.backoffice .metrics,
  body.backoffice .metrics-3,
  body.backoffice .metrics-4,
  body.backoffice .metrics-5 {
    grid-template-columns: 1fr;
  }

  body.backoffice .topbar h2,
  body.backoffice .topbar .badge,
  body.backoffice .topbar #refresh,
  body.backoffice .topbar #refresh-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.backoffice *,
  body.backoffice *::before,
  body.backoffice *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Final cascade safeguards */
body.backoffice .content{width:100%;max-width:1440px;margin-inline:auto}
body.backoffice .metric:hover,body.backoffice .usage-card:hover,body.backoffice .site-card:hover{transform:none!important;box-shadow:var(--shadow-card)!important;border-color:var(--line)!important}
body.backoffice .subscription-overview>div>.badge,body.backoffice .agency-summary>div>.badge{display:inline-flex!important;width:max-content!important;align-self:start!important}
body.backoffice .brand-logo-only{width:100%;min-height:70px;justify-content:flex-start;padding:8px 4px}
body.backoffice .brand-logo-only .brand-mark{width:100%;height:54px;max-width:none;background:transparent;border-radius:0;box-shadow:none;justify-content:flex-start;color:var(--ink);font-size:28px}
body.backoffice .brand-logo-only .brand-mark img{width:100%;height:100%;max-width:176px;object-fit:contain;object-position:left center;padding:0}
body.backoffice .login-card .brand-logo-only{justify-content:center}body.backoffice .login-card .brand-logo-only .brand-mark{justify-content:center}body.backoffice .login-card .brand-logo-only .brand-mark img{object-position:center}
body.backoffice .app-footer .saas-credit{position:static!important;width:auto!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important}
body.backoffice .audit-icon { width: 10px !important; height: 10px !important; padding: 0 !important; flex: 0 0 10px !important; }
body.backoffice .audit-action small { display: block; margin-top: 2px; }
