.button {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--action-blue-700);
  border-radius: 10px;
  background: var(--action-blue-700);
  color: #fff;
  text-decoration: none;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(7, 93, 204, .16);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--action-blue-800);
  background: var(--action-blue-800);
  box-shadow: 0 10px 22px rgba(7, 93, 204, .22);
}

.button:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.workspace-switcher select:focus-visible {
  outline: 0;
  border-color: var(--action-blue-500);
  box-shadow: var(--shadow-focus);
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink-800);
  box-shadow: none;
}

.button.secondary:hover {
  border-color: #a9c4df;
  background: var(--action-blue-050);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-700);
  box-shadow: none;
}

.button.compact {
  min-height: 36px;
  padding-inline: 11px;
}

.card,
.panel,
.form-card,
.list-panel,
.work-section,
.work-summary {
  background: var(--surface-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 22px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
}

.section {
  margin-top: 28px;
}

.section-head {
  margin-bottom: 12px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
}

.muted {
  color: var(--ink-600);
  font-size: var(--text-sm);
}

.kicker {
  color: var(--brand-cyan-700);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: var(--weight-extrabold);
  font-size: var(--text-xs);
}

.collection-page {
  display: grid;
  gap: 16px;
}

.collection-page-notice {
  margin: 0;
}

.list-panel {
  overflow: hidden;
}

.list-panel-head {
  min-height: 76px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--surface-card-muted));
}

.list-panel-copy {
  min-width: 0;
}

.list-panel-copy h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
}

.list-panel-copy p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--ink-600);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.list-panel-action {
  flex: 0 0 auto;
}

.list-panel-body {
  min-width: 0;
}

.list-panel-table {
  width: 100%;
  overflow: auto;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #e6edf5;
  text-align: left;
  font-size: var(--text-sm);
  vertical-align: middle;
}

th {
  color: #64758b;
  background: var(--surface-card-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .01em;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--action-blue-050);
}

.table-action-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.empty-state {
  min-height: 210px;
  padding: 34px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.empty-state-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid #cfe7f6;
  border-radius: 15px;
  background: var(--brand-cyan-050);
  color: var(--brand-cyan-700);
}

.empty-state-copy {
  max-width: 600px;
}

.empty-state-copy h3 {
  margin: 0;
  color: var(--ink-950);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -.02em;
}

.empty-state-copy p {
  margin: 7px 0 0;
  color: var(--ink-600);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.form-page,
.work-page {
  width: 100%;
}

.form-card,
.work-page {
  width: min(100%, var(--form-content-max));
  margin-inline: auto;
}

.form-card {
  overflow: hidden;
}

.form-card > .notice {
  margin: 24px 28px 0;
}

.work-page {
  display: grid;
  gap: 16px;
}

.work-summary {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 1.55fr) repeat(3, minmax(150px, .7fr));
}

.work-summary-item {
  min-width: 0;
  min-height: 92px;
  padding: 17px 19px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-right: 1px solid var(--line);
}

.work-summary-item:last-child {
  border-right: 0;
}

.work-summary-item > span {
  color: var(--ink-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.work-summary-item > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-950);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-summary-item > small {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-600);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-section,
.work-section {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 34px;
  padding: 30px 32px;
}

.form-section + .form-section {
  border-top: 1px solid var(--line);
}

.form-section-head,
.work-section-head {
  align-self: start;
  min-width: 0;
  padding-right: 26px;
  border-right: 1px solid var(--line);
}

.form-section-head h2,
.work-section-head h2 {
  margin: 5px 0 0;
  color: var(--ink-950);
  font-size: var(--text-xl);
  line-height: 1.25;
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
}

.form-section-head p,
.work-section-head p {
  max-width: 225px;
  margin: 9px 0 0;
  color: var(--ink-600);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.work-section-meta {
  width: fit-content;
  margin-top: 14px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-card-muted);
  color: var(--ink-650);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.form-section-body,
.work-section-body {
  min-width: 0;
}

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

.field {
  grid-column: span 6;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.field.full,
.field.span-12 {
  grid-column: span 12;
}

.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }
.field.span-5 { grid-column: span 5; }
.field.span-6 { grid-column: span 6; }
.field.span-7 { grid-column: span 7; }
.field.span-8 { grid-column: span 8; }
.field.span-9 { grid-column: span 9; }


.choice-field {
  grid-column: span 4;
  min-width: 0;
}

.choice-field label {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-800);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
}

.choice-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--action-blue-600);
}

.field label {
  color: var(--ink-800);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-950);
  box-shadow: inset 0 1px 0 rgba(5, 18, 32, .02);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.field textarea {
  min-height: 124px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #9db6cf;
}

.hint {
  color: var(--ink-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.form-section-toolbar {
  margin-bottom: 16px;
  display: flex;
  justify-content: flex-end;
}

.form-actions {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 34px;
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  background: var(--surface-card-muted);
}

.form-actions-inner {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

[data-tenant-row] {
  margin-top: 12px;
  padding: 18px;
}

@media (max-width: 900px) {
  .work-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-summary-item:nth-child(2) {
    border-right: 0;
  }

  .work-summary-item:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .form-section,
  .work-section {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 20px;
  }

  .form-section-head,
  .work-section-head {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-section-head p,
  .work-section-head p {
    max-width: none;
  }

  .work-summary {
    grid-template-columns: 1fr;
  }

  .work-summary-item,
  .work-summary-item:nth-child(2) {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .work-summary-item:last-child {
    border-bottom: 0;
  }

  .work-summary-item > strong,
  .work-summary-item > small {
    white-space: normal;
  }
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #cbe5f6;
  border-radius: var(--radius-sm);
  background: var(--brand-cyan-050);
  color: #24425f;
  font-size: var(--text-sm);
}

.notice.warning {
  border-color: #f2d9ae;
  background: var(--warning-100);
  color: var(--warning-700);
}

.badge,
.status-chip {
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--brand-cyan-100);
  color: var(--brand-cyan-700);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.status-chip.is-live {
  background: var(--success-100);
  color: var(--success-700);
}

.status-chip.is-warning {
  background: var(--warning-100);
  color: var(--warning-700);
}

.toast-region {
  position: fixed;
  z-index: 220;
  top: 86px;
  right: 22px;
  width: min(430px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  position: relative;
  min-height: 62px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) 40px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(174, 202, 228, .92);
  border-radius: 14px;
  background: var(--surface-card);
  color: var(--ink-950);
  box-shadow:
    0 18px 48px rgba(1, 10, 24, .22),
    0 3px 10px rgba(1, 10, 24, .08);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: toast-enter 180ms cubic-bezier(.2, .8, .2, 1);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px) scale(.985);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-accent {
  background: var(--action-blue-700);
}

.toast-success .toast-accent {
  background: var(--success-700);
}

.toast-error .toast-accent {
  background: var(--danger-700);
}

.toast-warning .toast-accent {
  background: var(--warning-700);
}

.toast-body {
  min-width: 0;
  padding: 15px 14px 14px;
  display: grid;
  align-content: center;
}

.toast-message {
  color: #14283f;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast-close {
  width: 40px;
  min-height: 62px;
  padding: 0;
  display: grid;
  place-items: center;
  align-self: stretch;
  border: 0;
  border-left: 1px solid rgba(52, 83, 112, .08);
  background: transparent;
  color: var(--ink-500);
  font-size: 21px;
  font-weight: var(--weight-regular);
  cursor: pointer;
  transition:
    color var(--transition),
    background var(--transition);
}

.toast-close:hover {
  color: var(--ink-950);
  background: var(--surface-3);
}

.toast-close:focus-visible {
  outline: 0;
  color: var(--action-blue-700);
  box-shadow: inset 0 0 0 2px rgba(8, 120, 232, .28);
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .form-section {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px;
  }

  .form-section-head {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-section-head p {
    max-width: 680px;
  }

  .form-actions {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 18px 24px;
  }

  .form-actions-inner {
    grid-column: 1;
  }

  .form-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .choice-field,
  .field,
  .field.full,
  .field.span-3,
  .field.span-4,
  .field.span-5,
  .field.span-6,
  .field.span-7,
  .field.span-8,
  .field.span-9,
  .field.span-12 {
    grid-column: 1 / -1;
  }

  .list-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-panel-action {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .toast-region {
    top: 74px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* Selects Diasphere : rendu applicatif commun, le select natif reste la source de vérité du formulaire. */
.ui-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.ui-select-native {
  position: absolute;
  inset: auto auto 0 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.ui-select-trigger {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 11px 42px 11px 13px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-950);
  box-shadow: inset 0 1px 0 rgba(5, 18, 32, .02);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.ui-select-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-500);
  border-bottom: 2px solid var(--ink-500);
  transform: translateY(-65%) rotate(45deg);
  transition: transform var(--transition);
  pointer-events: none;
}

.ui-select-trigger:hover {
  border-color: #9db6cf;
}

.ui-select-trigger:focus-visible,
.ui-select.is-open .ui-select-trigger {
  outline: 0;
  border-color: var(--action-blue-500);
  box-shadow: var(--shadow-focus);
}

.ui-select.is-open .ui-select-trigger::after {
  transform: translateY(-25%) rotate(225deg);
}

.ui-select.is-disabled .ui-select-trigger,
.ui-select-trigger:disabled {
  background: var(--surface-card-muted);
  color: var(--ink-500);
  cursor: not-allowed;
  opacity: .78;
}

.ui-select-menu {
  position: absolute;
  z-index: 220;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  max-height: 286px;
  padding: 6px;
  display: none;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(4, 16, 33, .18);
}

.ui-select.is-open .ui-select-menu {
  display: grid;
  gap: 2px;
}

.ui-select.opens-up .ui-select-menu {
  top: auto;
  bottom: calc(100% + 7px);
}

.ui-select-option {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-800);
  text-align: left;
  cursor: pointer;
}

.ui-select-option:hover,
.ui-select-option:focus-visible,
.ui-select-option[aria-selected="true"] {
  outline: 0;
  background: var(--action-blue-050);
  color: var(--action-blue-800);
}

.ui-select-option:disabled {
  color: var(--ink-400);
  background: transparent;
  cursor: not-allowed;
}

.ui-select-group {
  padding: 8px 10px 4px;
  color: var(--ink-500);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .04em;
  text-transform: uppercase;
}
