/* ==========================================================================
   Espace ROC — constructeur de prompts (mobile d'abord)
   ========================================================================== */

/* Lettres R O C F */
.roc-letters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 26px 0 22px; max-width: 420px; }
.roc-letters div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }
.roc-letters b { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #fff; font: 800 1.05rem var(--font-head); }
.roc-letters span { font: 600 0.78rem var(--font-head); color: #d0d7ec; }
.roc-letters-lg { margin-top: 34px; }

.roc-letter { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; font: 800 0.95rem var(--font-head); flex-shrink: 0; box-shadow: 0 6px 14px -8px rgba(91, 44, 184, 0.9); }
.roc-letter.lg { width: 48px; height: 48px; font-size: 1.3rem; border-radius: 14px; margin-bottom: 16px; }

/* Sous-navigation */
.roc-subnav { background: var(--navy-900); border-bottom: 1px solid rgba(255, 255, 255, 0.06); color: #c5cde4; }
.roc-subnav .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.roc-hello { display: flex; align-items: center; gap: 10px; min-width: 0; }
.roc-hello small { display: block; font: 700 0.66rem var(--font-head); letter-spacing: 0.16em; text-transform: uppercase; color: var(--violet-400); }
.roc-hello strong { color: #fff; font: 600 0.95rem var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 220px; }
.roc-tabs { display: flex; gap: 4px; align-items: center; }
.roc-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; color: #c7cfe6; font: 600 0.88rem var(--font-head); }
.roc-tabs a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.roc-tabs a.is-active { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 -2px 0 var(--violet-400); }
.roc-tabs .roc-logout { padding: 9px 10px; }
@media (max-width: 720px) {
  .roc-subnav .container { flex-direction: column; align-items: stretch; gap: 0; padding-top: 10px; }
  .roc-hello { display: none; }
  .roc-tabs { justify-content: space-between; }
  .roc-tabs a { flex-direction: column; gap: 3px; font-size: 0.72rem; padding: 8px 6px; flex: 1; border-radius: 10px 10px 0 0; }
  .roc-tabs a.is-active { box-shadow: inset 0 -3px 0 var(--violet-400); background: transparent; }
  .roc-tabs .roc-logout { flex: 0 0 48px; }
}

/* Mise en page */
.roc-app-page { background: var(--bg-soft); }
.roc-app-page .site-footer { margin-top: 0; }
.roc-main { padding-block: 28px 56px; }
.roc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.roc-form, .roc-side { min-width: 0; }
.roc-side { position: sticky; top: calc(var(--header-h) + 16px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (max-width: 1060px) { .roc-layout { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 900px) {
  .roc-layout { grid-template-columns: minmax(0, 1fr); }
  .roc-side { position: static; }
  .roc-main { padding-top: 16px; }
}

.roc-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-sm); }
.roc-card + .roc-card { margin-top: 18px; }
.roc-side .roc-card + .roc-card { margin-top: 0; }
@media (max-width: 520px) { .roc-card { padding: 18px 16px; border-radius: 16px; } }

.roc-step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.roc-step-head h2 { font-size: 1.12rem; margin: 0 0 2px; }
.roc-step-head p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.roc-step-head p.is-saved { color: #13773b; font-weight: 600; }
.roc-step { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy-900); color: #fff; font: 800 0.85rem var(--font-head); flex-shrink: 0; }
.roc-progress { margin-left: auto; font: 700 0.8rem var(--font-head); padding: 5px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); transition: all 0.2s; }
.roc-progress.is-complete { background: rgba(31, 168, 85, 0.12); color: #13773b; border-color: transparent; }

/* Profils */
.roc-profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.roc-profile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; -webkit-tap-highlight-color: transparent; }
.roc-profile:hover { border-color: #c4cfe4; }
.roc-profile.is-active { border-color: var(--blue-600); background: linear-gradient(135deg, rgba(36, 87, 178, 0.07), rgba(123, 31, 162, 0.07)); box-shadow: 0 0 0 3px rgba(47, 107, 216, 0.14); }
.roc-profile-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--bg-soft); color: var(--blue-600); flex-shrink: 0; }
.roc-profile.is-active .roc-profile-icon { background: var(--grad); color: #fff; }
.roc-profile-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.roc-profile-text strong { font: 700 0.86rem var(--font-head); color: var(--ink); }
.roc-profile-text small { font-size: 0.74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .roc-profiles { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 2px 16px 8px; gap: 8px; scrollbar-width: none; }
  .roc-profiles::-webkit-scrollbar { display: none; }
  .roc-profile { flex: 0 0 auto; scroll-snap-align: start; padding: 8px 12px 8px 8px; }
  .roc-profile-text small { display: none; }
  .roc-profile-icon { width: 32px; height: 32px; }
}

/* Champs */
.roc-field { padding: 16px 0; border-top: 1px solid var(--line); }
.roc-field:first-of-type { border-top: 0; padding-top: 0; }
.roc-field-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.roc-field-head label { font-size: 1rem; display: block; }
.roc-field-head small { display: block; color: var(--muted); font-size: 0.83rem; line-height: 1.4; margin-top: 1px; }
.roc-field.is-filled .roc-letter { box-shadow: 0 0 0 3px rgba(31, 168, 85, 0.18); }
.roc-clear { margin-left: auto; background: none; border: 0; color: var(--subtle); padding: 6px; border-radius: 8px; cursor: pointer; }
.roc-clear:hover { color: var(--red-500); background: #fdf0f0; }
.roc-field textarea { min-height: 64px; font-size: 1rem; line-height: 1.5; resize: none; overflow: hidden; border-radius: 12px; }
.roc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.roc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px; border: 1px dashed #c3cde0; background: var(--bg-softer); color: var(--text); font: 500 0.8rem/1.3 var(--font-body); cursor: pointer; text-align: left; transition: all 0.15s; -webkit-tap-highlight-color: transparent; }
.roc-chip::before { content: "+"; font-weight: 700; color: var(--violet-600); }
.roc-chip:hover { border-style: solid; border-color: var(--blue-500); color: var(--blue-600); background: #fff; }
.roc-chip:active { transform: scale(0.97); }

/* Options */
.roc-options { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.roc-options summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: 600 0.9rem var(--font-head); color: var(--ink); list-style: none; padding: 4px 0; }
.roc-options summary::-webkit-details-marker { display: none; }
.roc-options summary .icon { color: var(--muted); }
.roc-options-grid { display: grid; gap: 14px; margin-top: 14px; }
.roc-opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.roc-opt-row .label { font-size: 0.9rem; }
.roc-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }
.roc-seg label { cursor: pointer; }
.roc-seg input { position: absolute; opacity: 0; pointer-events: none; }
.roc-seg span { display: block; padding: 7px 14px; border-radius: 8px; font: 600 0.84rem var(--font-head); color: var(--muted); }
.roc-seg input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.roc-seg input:focus-visible + span { outline: 2px solid var(--blue-500); }

/* Aperçu */
.roc-preview .roc-step-head { margin-bottom: 14px; }
.roc-preview input[data-title] { min-height: 42px; padding: 9px 12px; font-size: 0.92rem; border-radius: 10px; }
.roc-output-wrap { position: relative; border-radius: 14px; background: var(--navy-900); margin-bottom: 10px; min-height: 180px; }
.roc-output { margin: 0; padding: 18px; max-height: 52vh; overflow: auto; color: #e3e8f6; font: 400 0.88rem/1.6 var(--font-mono); white-space: pre-wrap; word-wrap: break-word; border-radius: 14px; }
.roc-output:focus { outline: 2px solid var(--violet-400); }
.roc-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; color: #95a1c3; font-size: 0.9rem; }
.roc-empty .icon { width: 28px; height: 28px; color: var(--violet-400); }
.roc-empty p { margin: 0; max-width: 240px; }
.roc-empty strong { color: #fff; }
.roc-meta { font-size: 0.78rem; color: var(--muted); min-height: 1.2em; margin-bottom: 12px; }
.roc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.roc-actions .btn { padding-inline: 6px; min-width: 0; gap: 0.35em; }
@media (max-width: 400px) { .roc-actions { gap: 6px; } .roc-actions .btn { font-size: 0.8rem; } }
.roc-open { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.84rem; }
.roc-open span { color: var(--muted); }
.roc-open a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.roc-open .icon { width: 0.9em; height: 0.9em; }
.roc-note { display: flex; gap: 8px; align-items: flex-start; font-size: 0.78rem; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.roc-note .icon { width: 1em; height: 1em; margin-top: 2px; color: var(--green-500); }

/* Récents */
.roc-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.roc-recent-head h3 { font-size: 1rem; margin: 0; }
.roc-recent-head .link-arrow { font-size: 0.82rem; }
.roc-recent ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.roc-recent li, .roc-recent a { min-width: 0; }
.roc-recent a { display: block; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.roc-recent a:hover { background: var(--bg-soft); color: var(--ink); }
.roc-recent a.is-current { background: rgba(36, 87, 178, 0.08); }
.roc-recent-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roc-recent small { color: var(--muted); font-size: 0.76rem; }
.icon.is-fav { color: #e0a100; fill: #e0a100; width: 1em; height: 1em; }

/* Barre d'action mobile */
.roc-bottombar { display: none; }
@media (max-width: 900px) {
  .roc-bottombar { display: grid; grid-template-columns: auto 1fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -12px rgba(13, 27, 61, 0.2); }
  .roc-bottombar .btn { min-height: 50px; }
  body.has-bottom-bar { padding-bottom: 76px; }
  body.has-bottom-bar .toast { bottom: 90px; }
}

/* En-tête de page */
.roc-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.roc-page-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 4px; }
.roc-h2 { font-size: 1.15rem; margin-bottom: 16px; }

/* Historique */
.roc-filters { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto auto; gap: 10px; margin-bottom: 18px; align-items: center; }
.roc-search { position: relative; }
.roc-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.roc-search input { padding-left: 42px; }
.roc-fav-toggle { cursor: pointer; }
.roc-fav-toggle input { position: absolute; opacity: 0; }
.roc-fav-toggle span { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 48px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: #fff; font: 600 0.88rem var(--font-head); color: var(--muted); }
.roc-fav-toggle input:checked + span { border-color: #e0a100; color: #8a6200; background: #fff8e1; }
.roc-fav-toggle input:checked + span .icon { fill: #e0a100; color: #e0a100; }
@media (max-width: 760px) { .roc-filters { grid-template-columns: 1fr 1fr; } .roc-search { grid-column: 1 / -1; } .roc-filters .btn { grid-column: 1 / -1; } }

.roc-list { display: grid; gap: 14px; }
.roc-item { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); }
.roc-item.is-fav { border-color: #f0d68a; }
.roc-item-head { display: flex; align-items: flex-start; gap: 12px; }
.roc-item-title { flex: 1; min-width: 0; }
.roc-item-title h3 { font-size: 1.02rem; margin: 0 0 2px; }
.roc-item-title h3 a { color: var(--ink); }
.roc-item-title h3 a:hover { color: var(--blue-600); }
.roc-item-title small { color: var(--muted); font-size: 0.8rem; }
.roc-fav-form .btn.is-on { color: #e0a100; }
.roc-fav-form .btn.is-on .icon { fill: #e0a100; }
.roc-item-text { margin: 14px 0; padding: 12px 14px; border-radius: 12px; background: var(--bg-softer); border: 1px solid var(--line); color: var(--text); font: 400 0.82rem/1.55 var(--font-mono); white-space: pre-wrap; word-wrap: break-word; max-height: 4.9em; overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.roc-item-text.is-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.roc-item-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.roc-item-actions form { margin: 0; }
.roc-item-actions form:last-child { margin-left: auto; }
.roc-del:hover { color: var(--red-500); }

.roc-danger summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font: 600 0.95rem var(--font-head); color: var(--red-500); list-style: none; }
.roc-danger summary::-webkit-details-marker { display: none; }
.stat-card .icon { color: var(--violet-600); }

/* Page d'accueil ROC (visiteurs) */
.roc-hero { padding-bottom: clamp(64px, 8vw, 104px); }
.roc-hero .phone-mock { transform: rotate(-2deg); }
.roc-method h3 { margin-bottom: 4px; }
.roc-method p { color: var(--muted); margin-bottom: 12px; }
.roc-method em { display: block; font-style: normal; font-size: 0.88rem; padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); color: var(--ink); border-left: 3px solid var(--violet-500); }
.roc-compare { display: grid; gap: 14px; }
.roc-compare > div { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.roc-compare-bad p { margin: 10px 0 0; font-size: 1.05rem; color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(214, 69, 69, 0.5); }
.roc-compare-good { box-shadow: var(--shadow); }
.roc-compare pre { margin: 12px 0 0; padding: 16px; border-radius: 12px; background: var(--navy-900); color: #e3e8f6; font: 400 0.8rem/1.6 var(--font-mono); white-space: pre-wrap; }
.roc-profile-showcase { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.roc-profile.static { cursor: default; }
.faq { display: grid; gap: 10px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px; }
.faq summary { cursor: pointer; padding: 14px 0; font: 600 1rem var(--font-head); color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--violet-600); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin: 0 0 16px; }
