/* ============================================================
   TimeEcosModal — système de modale unique (socle V3)
   ------------------------------------------------------------
   Basé sur l'élément <dialog> natif. S'appuie sur les variables
   de theme.css (--surface, --text, --line, --shadow-lg…) afin de
   fonctionner automatiquement en thème clair ET sombre.
   Préfixe de classe dédié `tem-` (Time-Ecos Modal) pour éviter
   toute collision avec .modal-* (admin) et .te-modal-* (sujets).
   ============================================================ */

/* Verrouillage du défilement du fond pendant l'ouverture */
html.tem-modal-open,
html.tem-modal-open body { overflow: hidden; }

/* Le <dialog> occupe tout l'écran et centre le cadre.
   Sa zone vide (hors cadre) sert de fond cliquable. */
dialog.tem-dialog {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 16px;
  border: 0;
  background: transparent;
  overflow: hidden;
  box-sizing: border-box;
}
dialog.tem-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
dialog.tem-dialog::backdrop {
  background: rgba(2, 8, 23, 0.55);
  backdrop-filter: blur(2px);
}
dialog.tem-dialog.tem-nonmodal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.55);
  backdrop-filter: blur(2px);
}

/* Cadre visible de la modale */
.tem-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;                 /* taille md par défaut */
  max-height: min(90vh, 760px);
  background: var(--surface, #f9fafb);
  color: var(--text, #04151f);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.15));
  overflow: hidden;
  animation: tem-frame-in 0.2s ease-out;
}
dialog.tem-dialog.tem-size-sm .tem-frame { max-width: 420px; }
dialog.tem-dialog.tem-size-lg .tem-frame { max-width: 820px; }
dialog.tem-dialog.tem-size-xl .tem-frame { max-width: 1040px; }
dialog.tem-dialog.tem-size-workspace .tem-frame {
  max-width: min(1180px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
}
dialog.tem-dialog.tem-size-creation .tem-frame {
  max-width: min(1120px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
}
dialog.tem-dialog.tem-size-import .tem-frame {
  max-width: min(1080px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
}
dialog.tem-dialog.tem-size-station .tem-frame {
  max-width: min(1180px, calc(100vw - 32px));
  height: min(880px, calc(100vh - 32px));
}

@keyframes tem-frame-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tem-frame { animation: none; }
}

/* En-tête (reste visible quand le corps défile) */
.tem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #f9fafb);
}
.tem-title {
  margin: 0;
  font-size: var(--text-lg, 1.125rem);
  font-weight: 700;
  color: var(--title-card, var(--brand, #004777));
}
.tem-heading {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.tem-subtitle {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.35;
}
.tem-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius, 6px);
  background: transparent;
  color: var(--muted, #6b7280);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition, 0.2s ease);
}
.tem-close:hover { background: rgba(180, 35, 24, 0.12); color: var(--danger, #b42318); }
.tem-close:focus-visible { outline: 2px solid var(--accent, #00afb5); outline-offset: 2px; }

/* Corps (zone défilante) */
.tem-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  line-height: var(--leading-normal, 1.5);
}
.tem-body p { margin: 0 0 0.75rem 0; }
.tem-body p:last-child { margin-bottom: 0; }

/* Pied (reste visible quand le corps défile) */
.tem-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #f9fafb);
}
.tem-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.tem-actions .btn {
  width: auto !important;
}

/* Champs de formulaire à l'intérieur d'une modale */
.tem-field { margin-bottom: 0.85rem; }
.tem-field:last-child { margin-bottom: 0; }
.tem-label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: var(--text-sm, 0.875rem);
}
.tem-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #ffffff);
  color: var(--text, #04151f);
  font: inherit;
}
.tem-input:focus-visible { outline: 2px solid var(--accent, #00afb5); outline-offset: 1px; }
.tem-help { margin-top: 0.3rem; font-size: var(--text-xs, 0.75rem); color: var(--muted, #6b7280); }
.tem-error { margin-top: 0.3rem; font-size: var(--text-xs, 0.75rem); color: var(--danger, #a30000); }

/* Contenus standards réutilisables dans les modales V3 */
.tem-stack {
  display: grid;
  gap: 0.85rem;
}
.tem-summary {
  padding: 0.85rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--surface, #f9fafb) 72%, var(--accent, #00afb5) 8%);
}
.tem-summary strong { color: var(--text, #04151f); }
.tem-list {
  margin: 0;
  padding-left: 1.2rem;
}
.tem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}
.tem-tile {
  padding: 0.8rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
}
.tem-tile-title {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 700;
}
.tem-stepper {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tem-stepper li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}
.tem-stepper span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--brand, #004777);
  color: #fff;
  font-weight: 700;
}
.tem-station-preview {
  padding: 1rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
}
.tem-station-preview h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.tem-eval-grid {
  display: grid;
  gap: 0.7rem;
}
.tem-eval-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
}
.tem-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 2rem;
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--accent, #00afb5) 16%, transparent);
  color: var(--brand, #004777);
  font-weight: 700;
}
/* En preset workspace, le corps s'étire (flex-column) pour que le plan occupe
   la hauteur fixe et que le pied reste collé en bas (voir .tem-body { flex }). */
dialog.tem-dialog.tem-size-workspace .tem-body {
  display: flex;
  flex-direction: column;
}
dialog.tem-dialog.tem-size-creation .tem-body {
  display: flex;
  flex-direction: column;
  padding: 0;
}
dialog.tem-dialog.tem-size-import .tem-body {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.tem-creation {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tem-creation-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: color-mix(in srgb, var(--surface, #f9fafb) 88%, var(--accent, #00afb5) 4%);
}
.tem-creation-progress {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}
.tem-creation-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.tem-creation-progress-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #04151f);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 700;
}
.tem-creation-progress-percent {
  flex: 0 0 auto;
  color: var(--brand, #004777);
  font-size: var(--text-sm, 0.875rem);
}
.tem-creation-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line, #e5e7eb) 72%, var(--surface, #f9fafb) 28%);
}
.tem-creation-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #00afb5);
  transition: width 0.2s ease;
}
.tem-creation-status {
  min-width: 9rem;
  margin: 0;
  justify-content: flex-end;
}
.tem-creation-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tem-creation-body > * {
  flex: 1 1 auto;
  min-height: 0;
}
.tem-creation.is-initializing .tem-creation-body > *:not(.tem-creation-initializing) {
  display: none !important;
}
.tem-creation-initializing {
  display: flex;
  flex: 1 1 auto;
  min-height: 14rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}
.tem-creation-initializing[hidden] {
  display: none !important;
}
.tem-creation-initializing-title {
  color: var(--text, #04151f);
  font-size: var(--text-lg, 1.125rem);
  font-weight: 800;
}
.tem-creation-initializing-message {
  max-width: 28rem;
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: var(--text-sm, 0.875rem);
}
.tem-creation-body .te-form-stepper {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #f9fafb);
}
.tem-creation-body .te-form-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
  color: var(--muted, #6b7280);
  font: inherit;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 700;
}
.tem-creation-body .te-form-step.is-active {
  border-color: var(--accent, #00afb5);
  background: color-mix(in srgb, var(--accent, #00afb5) 14%, var(--bg, #fff));
  color: var(--brand, #004777);
}
.tem-creation-body .te-form-step.is-done {
  border-color: color-mix(in srgb, var(--success, #15803d) 48%, var(--line, #e5e7eb));
  background: color-mix(in srgb, var(--success, #15803d) 10%, var(--bg, #fff));
  color: var(--success, #15803d);
}
.tem-creation-body .te-form-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 24px;
  overflow-y: auto;
}
.tem-creation-body .te-form-panel {
  max-width: 100%;
}
.tem-creation-body .te-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}
.tem-creation-body .te-form-field--full {
  grid-column: 1 / -1;
}
.tem-creation-body .te-form-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #f9fafb);
}
.tem-creation-body .te-form {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  flex-direction: column;
}
.tem-creation-body > div {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tem-creation-body .te-form-status {
  margin-top: 0.75rem;
  color: var(--danger, #b42318);
  font-weight: 600;
}
.tem-creation-body .timer-profile-phase-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) auto auto auto auto;
  gap: 0.75rem;
  align-items: center;
}
.tem-creation-body .timer-profile-phase-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tem-creation-body .timer-profile-duration-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted, #6b7280);
  font-size: var(--text-sm, 0.875rem);
}
.tem-creation-body .timer-profile-duration-field .form-input {
  width: 4.25rem;
  text-align: center;
}
.tem-creation-body .timer-profile-color-picker {
  position: relative;
  display: inline-flex;
  justify-content: center;
}
.tem-creation-body .timer-profile-color-picker .phase-color-trigger {
  width: 32px;
  height: 32px;
  border: 2px solid var(--surface, #fff);
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line, #e5e7eb);
  cursor: pointer;
}

/* Preset `importFlow` — grand flux d'import avec contenu métier libre
   (CSV, panier, aperçu, résultats) et progression serveur optionnelle. */
.tem-import-flow {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tem-import-flow-top {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: color-mix(in srgb, var(--surface, #f9fafb) 92%, var(--accent, #00afb5) 3%);
}
.tem-import-flow-top[hidden] {
  display: none !important;
}
.tem-import-flow-progress {
  display: grid;
  gap: 0.4rem;
}
.tem-import-flow-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.tem-import-flow-progress-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #04151f);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 700;
}
.tem-import-flow-progress-percent {
  flex: 0 0 auto;
  color: var(--muted, #6b7280);
  font-size: var(--text-sm, 0.875rem);
}
.tem-import-flow-progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line, #e5e7eb) 72%, var(--surface, #f9fafb) 28%);
}
.tem-import-flow-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #00afb5);
  transition: width 0.2s ease;
}
.tem-import-flow-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tem-import-flow-body > * {
  flex: 1 1 auto;
  min-height: 0;
}

/* Indicateur de sauvegarde partage par les assistants de creation. Il vit ici
   car le preset `creation` peut etre utilise hors admin.css, notamment owner-config. */
.te-save-status {
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #6b7280);
}
.te-save-status:empty { display: none; }
.te-save-status-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.te-save-status-ico {
  display: inline-flex;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
}
.te-save-status-ico svg {
  width: 14px;
  height: 14px;
}
.te-save-status.is-success { color: var(--muted, #6b7280); font-weight: 500; }
.te-save-status.is-success .te-save-status-ico { color: var(--success, #15803d); }
.te-save-status.is-loading .te-save-status-ico svg { animation: te-save-status-spin 0.8s linear infinite; }
.te-save-status.is-unsaved { color: var(--muted, #6b7280); }
.te-save-status.is-unsaved .te-save-status-ico { color: var(--warning, #d97706); }
.te-save-status.is-error { color: var(--danger, #a30000); font-weight: 700; }
@keyframes te-save-status-spin {
  to { transform: rotate(360deg); }
}
.tem-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 0.3fr) minmax(0, 1fr);
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 420px;
}
.tem-workspace-sidebar,
.tem-workspace-canvas {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
}
.tem-workspace-sidebar {
  padding: 0.8rem;
}
.tem-workspace-canvas {
  min-height: 420px;
  background:
    linear-gradient(var(--line, #e5e7eb) 1px, transparent 1px),
    linear-gradient(90deg, var(--line, #e5e7eb) 1px, transparent 1px),
    var(--surface, #f9fafb);
  background-size: 32px 32px;
  position: relative;
  overflow: hidden;
}
.tem-workspace-zone {
  position: absolute;
  left: 14%;
  top: 18%;
  width: 38%;
  height: 34%;
  border: 2px solid var(--brand, #004777);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--brand, #004777) 12%, transparent);
}
.tem-workspace-room {
  position: absolute;
  right: 14%;
  bottom: 18%;
  width: 24%;
  height: 22%;
  border: 2px solid var(--accent, #00afb5);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--accent, #00afb5) 16%, transparent);
}

/* ------------------------------------------------------------
   Preset `station` — cadre de la modale d'affichage de station
   (barre de vues + contenu principal + rail visio/PJ + slot chrono).
   Le contenu métier est injecté par l'appelant (station-display.js).
   ------------------------------------------------------------ */
dialog.tem-dialog.tem-size-station .tem-body {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.tem-station {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
/* Barre de vues par rôle (Aperçu / Médecin / PS-PSS / Évaluateur) */
.tem-station-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #f9fafb);
}
.tem-station-views[hidden] { display: none; }
.tem-station-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
  color: var(--muted, #6b7280);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-sm, 0.875rem);
  cursor: pointer;
  transition: var(--transition, 0.2s ease);
}
.tem-station-view-btn:hover { border-color: var(--accent, #00afb5); }
.tem-station-view-btn.is-active {
  border-color: var(--accent, #00afb5);
  background: color-mix(in srgb, var(--accent, #00afb5) 14%, var(--bg, #fff));
  color: var(--brand, #004777);
}
.tem-station-view-btn:focus-visible { outline: 2px solid var(--accent, #00afb5); outline-offset: 2px; }

/* Corps : contenu principal (gauche) + rail latéral (droite) */
.tem-station-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
}
.tem-station-main {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.tem-station-view[hidden] { display: none; }
.tem-station-rail {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.tem-station-rail[hidden] { display: none; }
.tem-station-visio,
.tem-station-attachments {
  padding: 0.85rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 6px);
  background: var(--bg, #fff);
}
.tem-station-visio[hidden],
.tem-station-attachments[hidden] { display: none; }

/* Capsule chrono lecture seule, posée dans l'en-tête (branchée au lot chrono) */
.tem-station-chrono {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.tem-station-chrono[hidden] { display: none; }

/* Helpers d'aperçu (galerie owner « Affichage des modales ») : capsule chrono
   factice + titres de section. Le rendu réel viendra de station-display.js. */
.tem-station-chrono-demo {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #00afb5) 16%, transparent);
  color: var(--brand, #004777);
  font-weight: 700;
  font-size: var(--text-sm, 0.875rem);
  white-space: nowrap;
}
.tem-station-demo-title { margin: 0 0 0.4rem; font-size: 1rem; }

/* Tablette / mobile : passage en une seule colonne, le corps défile en entier */
@media (max-width: 720px) {
  .tem-station-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .tem-station-main,
  .tem-station-rail { overflow: visible; }
  .tem-station-views {
    position: sticky;
    top: 0;
    z-index: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

/* Petits écrans : cadre quasi plein écran, boutons tactiles sans étirement forcé */
@media (max-width: 560px) {
  dialog.tem-dialog { padding: 8px; }
  .tem-frame { max-width: 100%; max-height: 94vh; }
  dialog.tem-dialog.tem-size-creation .tem-frame {
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }
  dialog.tem-dialog.tem-size-import .tem-frame {
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }
  /* Station : collée en haut (sous la status bar), hauteur dynamique + safe-area */
  dialog.tem-dialog.tem-size-station[open] { align-items: flex-start; }
  dialog.tem-dialog.tem-size-station {
    padding:
      max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  dialog.tem-dialog.tem-size-station .tem-frame {
    height: auto;
    max-height: 96dvh;
  }
  .tem-station-layout { padding: 14px; }
  .tem-header {
    align-items: flex-start;
    padding: 14px 14px;
  }
  .tem-title { font-size: 1rem; }
  .tem-subtitle { font-size: 0.8rem; }
  .tem-creation-top {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 10px 14px;
  }
  .tem-creation-status {
    justify-content: flex-start;
    min-width: 0;
  }
  .tem-import-flow-top {
    padding: 10px 14px;
  }
  .tem-actions {
    justify-content: flex-end;
    align-items: center;
  }
  .tem-actions .btn {
    width: auto !important;
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 44px;
    max-width: 100%;
  }
  .tem-eval-row { grid-template-columns: 1fr; }
  .tem-workspace { grid-template-columns: 1fr; }
  .tem-workspace-canvas { min-height: 320px; }
}
