:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #202735;
  background: #f3f5f8;
  --accent: #a60c20;
  --line: #dce2eb;
  --muted: #637083;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
}
a {
  color: var(--accent);
}
button,
input,
select {
  font: inherit;
}
input,
select {
  display: block;
  width: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bbc6d3;
  background: white;
  border-radius: 10px;
  color: inherit;
}
input[type='date'] {
  -webkit-appearance: none;
  appearance: none;
}
input::-webkit-date-and-time-value {
  min-height: 1.5em;
  min-width: 0;
  text-align: left;
}
input[type='checkbox'] {
  width: 21px;
  min-height: 21px;
  flex-shrink: 0;
}
input[type='color'] {
  padding: 4px;
}
label {
  display: block;
  font-size: 0.83rem;
  font-weight: 650;
  margin: 14px 0 5px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary,
.secondary,
summary {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.secondary {
  background: white;
  color: #293548;
}
.danger {
  color: var(--accent);
}
summary {
  cursor: pointer;
  font-size: 0.8rem;
  background: #f8f9fb;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #2264a4;
  outline-offset: 3px;
}
.studio-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: calc(15px + env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 15px
    max(22px, env(safe-area-inset-left));
  background: white;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 850;
  font-size: 1.45rem;
  letter-spacing: -0.05em;
  color: #202735;
  text-decoration: none;
  white-space: nowrap;
}
.brand span {
  color: var(--accent);
}
.brand small {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-left: 10px;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fff3da;
  color: #8b5b16;
  font-size: 0.65rem;
  font-weight: 650;
}
.back {
  margin-left: auto;
  font-size: 0.8rem;
  text-decoration: none;
}
.studio-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  max-width: 1560px;
  margin: auto;
}
.studio-layout > aside {
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  min-height: calc(100dvh - 80px);
}
.eyebrow {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 0 0 8px;
}
nav {
  display: grid;
  gap: 6px;
}
nav button {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 13px 12px;
  border-radius: 10px;
  min-height: 44px;
  color: var(--muted);
  font-weight: 600;
}
nav button[aria-current] {
  background: #fbecef;
  color: var(--accent);
}
.sidebar-note {
  margin-top: 28px;
  font-size: 0.73rem;
  color: var(--muted);
}
main {
  min-width: 0;
  padding: 30px;
  overflow-wrap: anywhere;
}
h1 {
  font-size: 1.85rem;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin: 0 0 10px;
}
h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}
h3 {
  font-size: 0.9rem;
  margin: 18px 0 8px;
}
.lead,
.small {
  color: var(--muted);
}
.lead {
  font-size: 0.9rem;
  margin: 0 0 22px;
}
.small {
  font-size: 0.76rem;
}
.card {
  min-width: 0;
  border: 1px solid var(--line);
  background: white;
  border-radius: 17px;
  padding: 22px;
  margin: 14px 0;
}
.card p {
  margin: 7px 0;
}
.card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}
.kpi {
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  min-width: 0;
}
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}
.kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.65rem;
  letter-spacing: -0.035em;
}
.kpi small {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
}
.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-two > .card {
  margin: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.form-grid > *,
fieldset {
  min-width: 0;
}
.wide {
  grid-column: 1/-1;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 18px;
}
.actions > * {
  flex: 0 1 auto;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
}
.check label {
  margin: 0;
  font-weight: 450;
}
.check span {
  font-size: 0.83rem;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 16px 0;
}
legend {
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0 5px;
}
.empty {
  padding: 32px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.notice,
#notice {
  background: #fff5e7;
  color: #75521c;
  border: 1px solid #edd9b8;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.82rem;
  margin: 12px 0;
}
.success {
  background: #eef8f2;
  color: #23674b;
  border-color: #b9ddcb;
}
.locked {
  max-width: 540px;
  margin: 30px auto;
}
.secret {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.12em;
  background: #f6f8fb;
  padding: 15px;
  border-radius: 10px;
  word-break: break-all;
}
.company-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.company-list button {
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 14px;
  min-height: 115px;
  color: inherit;
}
.company-list button:hover,
.company-list button[aria-current] {
  border-color: var(--accent);
}
.company-list strong {
  font-size: 0.95rem;
  display: block;
}
.company-list small {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
  margin-top: 6px;
}
.pill {
  background: #eef2f7;
  color: #536275;
  border-radius: 14px;
  padding: 3px 8px;
  font-size: 0.65rem;
}
.provider {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.status {
  font-size: 0.75rem;
  font-weight: 600;
}
.table-scroll {
  max-width: 100%;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.76rem;
}
th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 650;
  color: var(--muted);
}
.chart svg {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: auto;
}
.chart-total {
  font:
    700 20px -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  fill: #243040;
}
.chart-small {
  font:
    11px -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  fill: #637083;
}
.donut-layout {
  display: grid;
  grid-template-columns: minmax(100px, 180px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 220px;
}
.chart-key {
  list-style: none;
  padding: 0;
  margin: 0;
}
.chart-key li {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  margin: 12px 0;
}
.chart-key strong {
  margin-left: auto;
  white-space: nowrap;
}
.key-dot {
  display: block;
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.method {
  font-size: 0.73rem;
  line-height: 1.65;
  color: var(--muted);
  background: #f7f9fb;
  border-radius: 10px;
  padding: 14px;
}
.activation {
  max-width: 540px;
  margin: 40px auto;
  padding: 26px;
}
.activation > .brand {
  display: block;
  margin-bottom: 30px;
}
.activation button {
  margin-top: 20px;
}
.break {
  overflow-wrap: anywhere;
}
code {
  font-size: 0.75rem;
  word-break: break-all;
}
#root:empty::after {
  content: 'Chargement…';
  color: var(--muted);
}
@media (max-width: 1000px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .company-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-two {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 740px) {
  .studio-layout {
    display: block;
  }
  .studio-layout > aside {
    min-height: 0;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: white;
  }
  .studio-layout > aside > .eyebrow,
  .sidebar-note {
    display: none;
  }
  nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }
  nav button {
    flex-shrink: 0;
    padding: 10px;
    font-size: 0.75rem;
  }
  main {
    padding: 22px 16px max(30px, env(safe-area-inset-bottom));
  }
  h1 {
    font-size: 1.5rem;
  }
  .studio-header {
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    gap: 8px;
  }
  .brand {
    font-size: 1.3rem;
  }
  .brand small {
    font-size: 0.6rem;
    margin-left: 5px;
  }
  .badge {
    font-size: 0.55rem;
  }
  .back {
    font-size: 0.68rem;
  }
  .card {
    padding: 17px;
  }
  .kpi {
    padding: 14px;
  }
  .kpi strong {
    font-size: 1.4rem;
  }
  .company-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .donut-layout {
    gap: 10px;
    grid-template-columns: 130px minmax(0, 1fr);
  }
  .chart-key li {
    font-size: 0.7rem;
  }
  .locked {
    margin-top: 16px;
  }
}
@media (max-width: 360px) {
  .brand small {
    display: none;
  }
  .studio-header {
    gap: 6px;
  }
  .donut-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .donut-layout svg {
    max-width: 180px;
  }
  .kpi strong {
    font-size: 1.2rem;
  }
}

[hidden] {
  display: none !important;
}
.studio-header #lock-cockpit {
  font-size: 0.7rem;
  margin-left: auto;
}
.studio-header #lock-cockpit:not([hidden]) + .back {
  margin-left: 0;
}
@media (max-width: 430px) {
  .studio-header #lock-cockpit {
    padding: 8px;
    font-size: 0.62rem;
  }
  .studio-header .badge {
    display: none;
  }
}

.locked ol {
  padding-inline-start: 1.3em;
  line-height: 1.6;
}
.locked ol li + li {
  margin-top: 0.7em;
}
.locked .secret {
  user-select: all;
}

/* Cockpit GitHub / Render : états explicites et lisibles sur mobile */
.cloud-overview {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}
.cloud-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.cloud-summary > .cloud-status,
.cloud-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
}
.cloud-panel {
  min-width: 0;
}
.cloud-panel h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 1.05rem;
}
.cloud-status {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 14px 0;
}
.cloud-status strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.4;
}
.cloud-status small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.cloud-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  flex: none;
  font-weight: 800;
}
.cloud-indicator.good {
  background: #e4f5ec;
  color: #18734b;
}
.cloud-indicator.pending {
  background: #fff1db;
  color: #986015;
}
.cloud-panel .actions button {
  min-height: 48px;
}
@media (max-width: 740px) {
  .cloud-summary {
    grid-template-columns: 1fr;
  }
  .cloud-panel {
    padding: 15px;
  }
  .cloud-panel .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .cloud-panel .actions button {
    width: 100%;
  }
}

/* No extra focus frame: retain normal field borders and selected-state styles. */
:focus,
:focus-visible,
:focus-within {
  outline: none !important;
  outline-offset: 0 !important;
}

/* Shared OrgaSAV identity, with a navigation dedicated to the platform owner. */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand img {
  width: 84px;
  height: 64px;
  object-fit: contain;
}
.badge {
  background: #dcfce7;
  color: #166534;
  white-space: nowrap;
}
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
}
.studio-header {
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.studio-header button {
  min-height: 44px;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  background: #111a28;
  color: #eef3fb;
  --line: #354258;
  --muted: #aab8cb;
  --accent: #ef8595;
}
[data-theme='dark']
  :is(
    .studio-header,
    .studio-layout > aside,
    .card,
    .kpi,
    .company-list button,
    .cloud-panel,
    .cloud-summary > .cloud-status
  ) {
  background: #1b2535;
  color: #eef3fb;
}
[data-theme='dark'] :is(input, select, textarea, .secondary, summary, .method, .secret, .pill) {
  background: #27354a;
  color: #eef3fb;
  border-color: var(--line);
}
[data-theme='dark'] nav button[aria-current] {
  background: #342936;
  color: #ffb4bf;
}
[data-theme='dark'] .badge {
  background: #143d2b;
  color: #86efac;
}
[data-theme='dark'] .chart-total {
  fill: #eef3fb;
}
[data-theme='dark'] .chart-small {
  fill: #aab8cb;
}
@media (max-width: 740px) {
  .brand img {
    width: 66px;
    height: 50px;
  }
  .brand small {
    display: none;
  }
  .studio-header {
    gap: 6px;
  }
  .studio-header button {
    font-size: 0.72rem;
    padding: 8px;
  }
  nav {
    scrollbar-width: none;
  }
  .badge {
    display: inline-flex !important;
  }
}
