:root {
  --bg: #0b1220;
  --bg-soft: #111a2b;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --brand-deep: #0f766e;
  --brand-ink: #134e4a;
  --sky: #0284c7;
  --warn: #d97706;
  --ok: #059669;
  --err: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(13, 148, 136, 0.18), transparent 55%),
    radial-gradient(900px 500px at 110% 0%, rgba(2, 132, 199, 0.14), transparent 50%),
    linear-gradient(180deg, #eef4f8 0%, #e8eef5 40%, #f5f7fa 100%);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sky); }

/* —— Header —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.75rem 1.25rem;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.app-header a { color: #cbd5e1; text-decoration: none; font-weight: 500; font-size: 0.92rem; }
.app-header a:hover,
.app-header a.is-active { color: #fff; }

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff !important;
  letter-spacing: -0.02em;
}

.brand-logo {
  height: 36px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  flex-shrink: 0;
  padding: 0.2rem 0.45rem;
  background: #fff;
  border-radius: 8px;
}

.brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header nav {
  display: flex;
  gap: 0.35rem 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.user-meta {
  opacity: 0.75;
  font-size: 0.8rem;
  margin-right: 0.35rem;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  cursor: pointer;
}

/* —— Layout —— */
.wrap {
  width: min(1080px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
  color: var(--ink);
}

.page-head .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 40rem;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}

.panel + .panel { margin-top: 1rem; }

.panel h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--ink);
}

.lead { color: var(--muted); margin-top: 0; line-height: 1.5; }

/* —— Flash —— */
.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-info { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

/* —— Forms —— */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.1rem;
}

.form-grid .full { grid-column: 1 / -1; }

.field label,
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.4rem;
  color: #334155;
}

.hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.field-error {
  border-color: #f87171 !important;
}

.error-text {
  color: var(--err);
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

/* Scale radios */
.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.scale label {
  margin: 0;
  cursor: pointer;
}

.scale input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 64px;
  padding: 0.45rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  transition: 0.15s ease;
  text-align: center;
}

.scale span strong {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 600;
}

.scale input:checked + span,
.scale label:hover span {
  border-color: var(--brand);
  background: rgba(13, 148, 136, 0.08);
  color: var(--brand-ink);
}

.scale input:checked + span {
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
}

.scale-legend {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Checkboxes chips */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: 0.15s ease;
}

.chip input:checked + span {
  background: rgba(13, 148, 136, 0.12);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.chip:hover span { border-color: #94a3b8; }

.empty-types {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--brand-deep); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 0.85rem 1.4rem; font-size: 0.98rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.35rem;
  align-items: center;
}

/* —— Login —— */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
}

.login-visual {
  position: relative;
  overflow: auto;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.94), rgba(2, 132, 199, 0.78)),
    radial-gradient(circle at 30% 10%, rgba(255,255,255,0.22), transparent 42%),
    var(--bg);
  color: #fff;
  padding: clamp(1.75rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 28px,
      rgba(255,255,255,0.03) 28px,
      rgba(255,255,255,0.03) 29px
    );
  pointer-events: none;
}

.login-visual-inner {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
}

.login-logo-wrap {
  display: inline-flex;
  align-items: center;
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.9rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.login-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: min(240px, 70vw);
  object-fit: contain;
}

.login-visual .kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
  margin: 0 0 0.75rem;
}

.login-visual h1 {
  font-family: var(--display);
  font-size: clamp(1.75rem, 3.4vw, 2.45rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.12;
  margin: 0 0 0.85rem;
}

.login-lead {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  line-height: 1.55;
  opacity: 0.95;
  max-width: 42ch;
}

.login-lead strong { font-weight: 700; }

.login-about {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.25rem;
  backdrop-filter: blur(8px);
}

.login-about h2 {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.55rem;
}

.login-about > p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  opacity: 0.92;
}

.login-flow {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.login-flow li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.login-flow span {
  flex-shrink: 0;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
}

.login-roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.login-roles div {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.7rem;
}

.login-roles strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-roles p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  opacity: 0.88;
}

.login-public-note {
  margin: 0 !important;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.8rem !important;
  line-height: 1.5 !important;
  opacity: 0.9;
}

.login-side {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #f8fafc;
}

.login-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.6rem;
}

.login-card-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.login-card h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}

.demo-accounts {
  margin-top: 1.25rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}
.demo-accounts strong { color: var(--ink); display: block; margin-bottom: 0.25rem; }
.demo-accounts code {
  font-size: 0.74rem;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
  color: var(--ink);
}

/* —— Stats —— */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.stat {
  background: linear-gradient(180deg, #fff, var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.05rem;
}

.stat .label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.stat .value {
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-top: 0.25rem;
  font-weight: 600;
}

.role-pill,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(13, 148, 136, 0.12);
  color: var(--brand-ink);
}

.badge-pending { background: #fff7ed; color: #9a3412; }
.badge-ok { background: #ecfdf5; color: #065f46; }
.badge-muted { background: #f1f5f9; color: #475569; }

/* —— Tables / lists —— */
.act-list { display: flex; flex-direction: column; gap: 0.75rem; }

.act-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.act-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.act-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta strong { color: #334155; font-weight: 600; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-2);
  color: #475569;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.detail-item {
  padding: 0.75rem 0.85rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.detail-item .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.detail-item .v {
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0 1rem 2rem;
}

.step-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.step-bar span {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.step-bar span.on {
  background: rgba(13, 148, 136, 0.15);
  color: var(--brand-ink);
}

/* —— Responsive —— */
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual {
    min-height: auto;
    padding: 1.5rem 1.25rem 1.75rem;
    justify-content: flex-start;
  }
  .login-lead { max-width: none; font-size: 0.98rem; margin-bottom: 1.1rem; }
  .login-roles { grid-template-columns: 1fr; }
  .login-side { padding: 1.25rem 1rem 2rem; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .brand-text { font-size: 0.92rem; max-width: 42vw; }
  .brand-logo { height: 30px; max-width: 100px; }
  .login-logo { height: 44px; }
  .app-header {
    flex-wrap: wrap;
  }
  .app-header nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding-top: 0.5rem;
  }
  .app-header nav.is-open { display: flex; }
  .app-header nav a,
  .app-header nav .btn-ghost {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
  }
  .user-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .scale { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.3rem; }
  .scale span { min-height: 56px; font-size: 0.68rem; padding: 0.35rem 0.1rem; }
  .act-card { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .scale { grid-template-columns: repeat(5, 1fr); }
  .scale span strong { font-size: 1rem; }
}

/* —— Notifications —— */
.nav-notif {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}
.notif-unread {
  border-color: #fdba74 !important;
  background: #fffbeb !important;
}

/* —— Filters / charts / admin —— */
.filters-panel h2 { margin-bottom: 0.85rem; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.bar-list { display: flex; flex-direction: column; gap: 0.65rem; }
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
  color: #334155;
}
.bar-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #0284c7);
  border-radius: 999px;
  min-width: 4px;
}
.chart-line {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

.app-footer a { color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--brand-deep); text-decoration: underline; }
.changelog {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #334155;
}

/* —— Site footer (légal) —— */
.site-footer {
  margin-top: 2rem;
  background: #0b1220;
  color: #94a3b8;
  font-size: 0.85rem;
}
.site-footer a { color: #cbd5e1; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer-inner {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr);
  gap: 1.75rem;
}
.site-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.site-footer-brand img {
  height: 40px;
  width: auto;
  max-width: 160px;
  align-self: flex-start;
  padding: 0.35rem 0.55rem;
  background: #fff;
  border-radius: 8px;
}
.site-footer-brand p { margin: 0; line-height: 1.45; }
.site-footer-brand strong { color: #f8fafc; }
.site-footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.site-footer h3 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 700;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.site-footer-note {
  margin: 0;
  line-height: 1.45;
  font-size: 0.8rem;
}
.site-footer-bar {
  border-top: 1px solid rgba(255,255,255,0.08);
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.75rem;
  color: #64748b;
}
.site-footer--compact .site-footer-inner { padding-top: 1.5rem; }
.app-footer-wrap { margin-top: 1rem; }

/* Login page + footer */
.login-page { min-height: auto; }
body:has(.login-page) { display: flex; flex-direction: column; min-height: 100vh; }
body:has(.login-page) .login-page { flex: 1; }

/* Legal pages */
.legal-body { background: #f5f7fa; }
.legal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  background: #0b1220;
  color: #e2e8f0;
}
.legal-top .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff !important;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
}
.legal-top nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.legal-top nav a { color: #cbd5e1; text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.legal-top nav a:hover { color: #fff; }
.legal-wrap { margin-bottom: 2rem; }
.legal-doc h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 1.35rem 0 0.55rem;
  letter-spacing: -0.02em;
}
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc p, .legal-doc li { line-height: 1.55; color: #334155; }
.legal-doc ul { padding-left: 1.2rem; }

@media (max-width: 860px) {
  .site-footer-inner { grid-template-columns: 1fr; }
  .site-footer-cols { grid-template-columns: 1fr; }
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.search-row input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
}
.search-row .btn { margin-top: 0; }
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.chip-link:hover {
  border-color: var(--brand);
  background: rgba(13, 148, 136, 0.08);
}
.hint-inline {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
}

.ac-wrap { position: relative; }
.ac-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow: auto;
}
.ac-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.ac-item:hover,
.ac-item:focus {
  background: rgba(13, 148, 136, 0.1);
  outline: none;
}
.ac-item strong { font-size: 0.92rem; }
.ac-item span { font-size: 0.78rem; color: var(--muted); }
.ac-empty {
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Statut discret sur les cartes d'acte */
.act-card--validated {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0.04) 12px, #fff 12px);
  border-color: #a7f3d0;
}
.act-card--submitted {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.05) 12px, #fff 12px);
  border-color: #fcd34d;
}
.act-card--draft {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.06) 12px, #fff 12px);
  border-color: #cbd5e1;
}
.act-card--cancelled {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.12), rgba(244, 63, 94, 0.04) 12px, #fff 12px);
  border-color: #fecdd3;
  opacity: 0.92;
}
.act-card--muted {
  border-color: var(--line);
}

/* —— Changelog mis en forme —— */
.changelog-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cl-intro {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
}
.cl-intro p {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.cl-intro p:last-child { margin-bottom: 0; }
.cl-intro code {
  font-size: 0.82em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
}
.cl-version {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem 1.35rem;
}
.cl-version--current {
  border-color: #99f6e4;
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.12), var(--shadow);
}
.cl-version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.cl-version-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.cl-ver { color: var(--brand-deep); }
.cl-date {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.cl-section {
  margin: 1rem 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: #475569;
}
.cl-section--added { background: #ecfdf5; color: #065f46; }
.cl-section--changed { background: #eff6ff; color: #1e40af; }
.cl-section--fixed { background: #fff7ed; color: #9a3412; }
.cl-section--removed { background: #fef2f2; color: #991b1b; }
.cl-list {
  margin: 0.45rem 0 0.25rem;
  padding: 0 0 0 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cl-list li {
  line-height: 1.5;
  color: #334155;
  font-size: 0.94rem;
  padding-left: 0.15rem;
}
.cl-list code {
  font-size: 0.82em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  color: var(--ink);
}
.cl-intro a,
.cl-list a { color: var(--brand-deep); }

/* —— Avatars —— */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ccfbf1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.avatar--sm { width: 28px; height: 28px; border-width: 1px; }
.avatar--lg { width: 56px; height: 56px; }
.user-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.page-head-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.act-card-main {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}
.act-card-main > div { min-width: 0; flex: 1; }
.person-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ac-item {
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.65rem !important;
}
.ac-item-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}

/* —— Fiche acte : statut coloré —— */
.status-banner {
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.status-banner-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}
.status-banner-main strong {
  font-weight: 600;
  font-size: 0.95rem;
}
.status-banner--status-validated {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-color: #a7f3d0;
  color: #065f46;
}
.status-banner--status-submitted {
  background: linear-gradient(135deg, #fffbeb, #fff7ed);
  border-color: #fcd34d;
  color: #9a3412;
}
.status-banner--status-draft {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.status-banner--status-cancelled {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}
.status-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.status-steps li {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  color: inherit;
  opacity: 0.55;
}
.status-steps li.is-done { opacity: 0.9; }
.status-steps li.is-current {
  opacity: 1;
  box-shadow: 0 0 0 2px currentColor;
  background: #fff;
}
.panel--status-validated { border-color: #a7f3d0; }
.panel--status-submitted { border-color: #fcd34d; }
.panel--status-draft { border-color: #cbd5e1; }
.panel--status-cancelled { border-color: #fecdd3; }
.detail-item--ok { background: #ecfdf5; }
.detail-item--wait { background: #fff7ed; }

/* —— Doc workflows —— */
.doc-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  counter-reset: step;
}
.doc-flow li {
  counter-increment: step;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
}
.doc-flow li::before {
  content: counter(step) ". ";
  font-weight: 700;
  color: var(--brand-deep);
}
.doc-role--student { border-left: 4px solid #0d9488; }
.doc-role--teacher { border-left: 4px solid #0284c7; }
.doc-role--admin { border-left: 4px solid #0f766e; }
.doc-status-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.doc-status-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* —— Documentation schemas —— */
.schema {
  margin: 1.15rem 0 0.25rem;
  padding: 1rem 1.1rem 1.15rem;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(13, 148, 136, 0.08), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-sm, 10px);
  overflow-x: auto;
}
.schema-caption {
  font-family: Sora, "Plus Jakarta Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin: 0 0 0.85rem;
}

.schema-track,
.schema-status-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem 0.15rem;
  min-width: min(100%, 36rem);
}

.schema-node,
.schema-status {
  flex: 1 1 7.5rem;
  min-width: 7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.schema-node strong,
.schema-status .badge {
  font-size: 0.95rem;
}
.schema-role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}
.schema-detail {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  line-height: 1.35;
}
.schema-node--student { border-top: 3px solid #0d9488; }
.schema-node--system { border-top: 3px solid #64748b; }
.schema-node--teacher { border-top: 3px solid #0284c7; }
.schema-node--team { border-top: 3px solid #0f766e; }

.schema-arrow {
  flex: 0 0 1.25rem;
  align-self: center;
  width: 1.25rem;
  height: 0.65rem;
  position: relative;
}
.schema-arrow::before {
  content: "";
  position: absolute;
  inset: 40% 0.15rem auto;
  height: 2px;
  background: #94a3b8;
}
.schema-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #94a3b8;
}

.schema-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.schema-steps::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 1.1rem;
  bottom: 1.1rem;
  width: 2px;
  background: linear-gradient(180deg, #0d9488, #99f6e4);
}
.schema-steps--teacher::before {
  background: linear-gradient(180deg, #0284c7, #bae6fd);
}
.schema-steps li {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.55rem 0;
  position: relative;
}
.schema-step-num {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Sora, sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  color: #fff;
  background: #0d9488;
  box-shadow: 0 0 0 4px #f8fafc;
  z-index: 1;
  flex-shrink: 0;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
}
.schema-steps--teacher .schema-step-num { background: #0284c7; }
.schema-steps li strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}
.schema-steps li div > span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted, #64748b);
  line-height: 1.4;
  margin-top: 0.1rem;
}

.schema-admin-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.65rem;
}
.schema-admin-grid li {
  padding: 0.85rem 0.9rem;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  border-left: 3px solid #0f766e;
}
.schema-admin-grid strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.schema-admin-grid span {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  line-height: 1.35;
}

.schema-status-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line, #e2e8f0);
  font-size: 0.84rem;
  color: var(--muted, #64748b);
}

.schema-scale {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}
.schema-scale li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 0.65rem 0.35rem;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
}
.schema-scale-n {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Sora, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  color: #fff;
  background: #0d9488;
  flex-shrink: 0;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
}
.schema-scale li:nth-child(1) .schema-scale-n { background: #b45309; }
.schema-scale li:nth-child(2) .schema-scale-n { background: #d97706; }
.schema-scale li:nth-child(3) .schema-scale-n { background: #0d9488; }
.schema-scale li:nth-child(4) .schema-scale-n { background: #0f766e; }
.schema-scale li:nth-child(5) .schema-scale-n { background: #115e59; }
.schema-scale-label {
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted, #64748b);
}

@media (max-width: 720px) {
  .schema-track,
  .schema-status-flow {
    flex-direction: column;
    min-width: 0;
  }
  .schema-arrow {
    flex: 0 0 1rem;
    width: 100%;
    height: 1rem;
    align-self: center;
  }
  .schema-arrow::before {
    inset: 0.15rem auto;
    left: 50%;
    width: 2px;
    height: 0.7rem;
    transform: translateX(-50%);
  }
  .schema-arrow::after {
    top: auto;
    bottom: 0;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #94a3b8;
    border-left-color: transparent;
  }
  .schema-scale {
    grid-template-columns: 1fr;
  }
  .schema-scale li {
    flex-direction: row;
    text-align: left;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
  }
}

.install-cmd {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  background: #0b1220;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
}


/* —— Admin référentiel (arborescence) —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}
.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.btn-icon:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: #f0fdfa;
}
.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ref-icon-form { display: inline; margin: 0; }

.ref-add h2 { margin-bottom: 0.65rem; }
.ref-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.ref-add-form input[type="text"] {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.ref-tree {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.ref-domain {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 14px);
  overflow: visible;
  scroll-margin-top: 5rem;
  position: relative;
}
.ref-domain.is-inactive {
  opacity: 0.72;
  background: #f8fafc;
}
.ref-domain-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-bottom: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 14px) var(--radius, 14px) 0 0;
}
.ref-domain-title {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  min-width: min(100%, 14rem);
}
.ref-domain-mark {
  width: 0.55rem;
  height: 2.4rem;
  border-radius: 999px;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.ref-domain.is-inactive .ref-domain-mark { background: #94a3b8; }
.ref-domain-title h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: Sora, "Plus Jakarta Sans", sans-serif;
}
.ref-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}
.ref-domain-tools,
.ref-type-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ref-types {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}
.ref-type {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.1rem 0.65rem 1.85rem;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  z-index: 1;
}
.ref-type:last-child { border-bottom: 0; }
.ref-type.is-inactive { opacity: 0.65; }
.ref-type-main {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: min(100%, 12rem);
}
.ref-type-main strong { font-weight: 600; margin-right: 0.4rem; }
.ref-type-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #99f6e4;
  flex-shrink: 0;
  box-shadow: -0.85rem 0 0 #e2e8f0;
  position: relative;
}
.ref-type-dot::before {
  content: "";
  position: absolute;
  left: -0.95rem;
  top: -1.4rem;
  width: 2px;
  height: 1.55rem;
  background: #e2e8f0;
}
.ref-empty {
  padding: 0.85rem 1.1rem 0.85rem 1.85rem;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}

.ref-add-type {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem 1rem 1.85rem;
  background: #f8fafc;
  border-top: 1px solid var(--line, #e2e8f0);
}
.ref-add-type input[type="text"] {
  flex: 1 1 14rem;
  min-width: 10rem;
}
.ref-add-type-hint {
  margin: 0;
  padding: 0.75rem 1.1rem 1rem 1.85rem;
  background: #f8fafc;
  border-top: 1px solid var(--line, #e2e8f0);
}

.ref-edit {
  position: relative;
  z-index: 1;
}
.ref-edit[open] {
  z-index: 40;
}
.ref-edit > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}
.ref-edit > summary::-webkit-details-marker { display: none; }
.ref-edit > summary:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}
.ref-edit[open] > summary {
  border-color: var(--brand);
  background: #f0fdfa;
}
.ref-edit-form {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  min-width: min(100vw - 2rem, 18rem);
}
.ref-edit-form input[type="text"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.ref-edit-form .btn {
  width: 100%;
}
.ref-type:has(.ref-edit[open]) {
  z-index: 30;
}
.ref-domain:has(.ref-edit[open]) {
  z-index: 20;
}

@media (max-width: 720px) {
  .ref-domain-head,
  .ref-type {
    flex-direction: column;
    align-items: stretch;
  }
  .ref-domain-tools,
  .ref-type-tools {
    justify-content: flex-start;
  }
  .ref-edit-form {
    position: static;
    margin-top: 0.35rem;
    box-shadow: none;
  }
}

.ref-domain.is-flash,
.ref-type.is-flash {
  animation: refFlash 1.4s ease;
  outline: 2px solid rgba(13, 148, 136, 0.55);
  outline-offset: 2px;
}
.ref-type.is-flash {
  background: #ecfdf5;
  border-radius: 8px;
}
@keyframes refFlash {
  0% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.35); }
  40% { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0.12); }
  100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); }
}
.ref-type { scroll-margin-top: 5.5rem; scroll-margin-bottom: 2rem; }

.ref-drag {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 1.05rem;
  line-height: 1;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}
.ref-drag:hover {
  color: var(--brand-deep);
  border-color: var(--line, #e2e8f0);
  background: #f8fafc;
}
.ref-drag:active { cursor: grabbing; }
.ref-drag-hint {
  display: inline-block;
  color: #94a3b8;
  font-size: 0.95rem;
  vertical-align: middle;
}
.ref-domain.is-dragging,
.ref-type.is-dragging {
  opacity: 0.45;
}
.ref-domain.is-drag-over {
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.45);
}
.ref-type.is-drag-over[data-drop-pos="before"] {
  box-shadow: inset 0 3px 0 0 var(--brand);
}
.ref-type.is-drag-over[data-drop-pos="after"] {
  box-shadow: inset 0 -3px 0 0 var(--brand);
}
.ref-types.is-drag-over {
  background: #ecfdf5;
  outline: 2px dashed rgba(13, 148, 136, 0.45);
  outline-offset: -2px;
  min-height: 2.5rem;
}
.ref-domain-title .ref-drag { margin-top: 0.2rem; }

.ref-toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  animation: refToastIn 0.25s ease;
}
.ref-toast--ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.ref-toast--err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
@keyframes refToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.act-card.is-flash {
  animation: refFlash 1.4s ease;
  outline: 2px solid rgba(13, 148, 136, 0.45);
  outline-offset: 2px;
}
.act-card.is-inactive {
  opacity: 0.72;
}
