/* Portail Smile Operator : socle repris de Smile (src/renderer/assets/base.css, panel.css, tasks.css).
   Jetons, typo, contrôles communs et pastilles de statut. Charger avant portal.css et board.css. */
:root {
  color-scheme: dark;
  --black: #000;
  --ink: #f5f6f8;
  --muted: #9398a1;
  --subtle: #8e939c;
  --hover: #141518;
  --selected: #1d1f23;
  --line: #23252a;
  --edge: #3a3d44;
  --card: rgba(20, 21, 24, .92);
  --green: #34d399;
  --amber: #f5a524;
  --claude: #d97757;
  --smile-claude: var(--claude);
  --red: #ff8d97;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  /* Marges latérales et zones sûres (encoche et barre d'accueil de l'iPhone). */
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --pad-left: max(var(--gutter), var(--safe-left));
  --pad-right: max(var(--gutter), var(--safe-right));
  --target: 30px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--black); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--black); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; padding: 0; }
a { color: inherit; }
button, a { transition: background-color 140ms, color 140ms, opacity 140ms; }
:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: wait; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--selected); border-radius: 8px; }
.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; }

/* Bouton d'outil (fermer, actualiser, sons). */
.icon-button { width: var(--target); height: var(--target); display: inline-grid; place-items: center; flex: none; border-radius: 7px; color: var(--muted); }
.icon-button:hover { color: var(--ink); background: var(--hover); }
.icon-button[aria-pressed="true"] { color: var(--ink); background: var(--selected); }
.icon-button:active, .secondary-button:active { opacity: .7; }
/* Action secondaire ; action principale en blanc (Smile : .action-primary). */
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--target); padding: 6px 11px; background: var(--hover); border-radius: 7px; font-size: 13px; white-space: nowrap; text-decoration: none; }
.secondary-button svg { width: 14px; height: 14px; }
.secondary-button:hover { background: var(--selected); }
.secondary-button.action-primary { background: var(--ink); color: var(--black); font-weight: 600; }
.secondary-button.action-primary:hover { background: var(--muted); }
.secondary-button[data-tone="danger"] { color: var(--red); }

/* Point de synchronisation (pied de la barre Smile). */
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot[data-state="synced"] { background: var(--green); }
.status-dot[data-state="offline"] { background: var(--amber); }
.status-dot[data-state="syncing"] { background: var(--ink); animation: live-pulse 1.4s ease-in-out infinite; }

/* Statut de tâche : pastille (anneau = à faire, plein = en cours, rouge = bloquée, vert = terminée). */
.status-mark { --status-color: var(--muted); display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1.4px var(--status-color); }
[data-status="en_cours"] { --status-color: var(--ink); }
[data-status="bloquee"] { --status-color: var(--red); }
[data-status="terminee"] { --status-color: var(--green); }
.status-mark:is([data-status="en_cours"], [data-status="bloquee"], [data-status="terminee"]) { box-shadow: none; background: var(--status-color); }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.status-label:is([data-status="en_cours"], [data-status="bloquee"], [data-status="terminee"]) { color: var(--status-color); }

/* Agent qui tient ou a tenu la tâche : Codex blanc, Claude orange (tasks.css : .held). */
.agent { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 1px 8px 1px 7px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; color: var(--muted); box-shadow: inset 0 0 0 1px var(--selected); }
.agent i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--ink); }
.agent[data-provider="claude"] i { background: var(--claude); }
.agent[data-live="work"] { color: var(--ink); background: rgba(245, 246, 248, .08); box-shadow: none; }
.agent[data-live="work"][data-provider="claude"] { color: var(--claude); background: rgba(217, 119, 87, .14); }
.agent[data-live="work"] i { animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* Champs de formulaire (tasks.css : .manager-field). */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 13px; }
.field > span, .field > legend { font-weight: 500; }
.field-hint { color: var(--subtle); font-size: 12px; font-weight: 400; }
.input { width: 100%; min-width: 0; height: 37px; padding: 7px 10px; font: inherit; color: var(--ink); background: var(--hover); border: 1px solid var(--selected); border-radius: 7px; }
textarea.input { height: auto; min-height: 84px; resize: vertical; line-height: 1.5; }
select.input { cursor: pointer; }
.input:disabled { opacity: .65; cursor: default; }
.input::placeholder { color: var(--subtle); }
fieldset.field { margin: 0; padding: 0; border: 0; }
/* Choix exclusif en pastilles (statut, fréquence). */
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 4px; padding: 3px; background: var(--hover); border-radius: 9px; }
.segmented label { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; text-align: center; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented label:hover { color: var(--ink); }
.segmented label:has(input:checked) { background: var(--selected); color: var(--ink); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Cibles tactiles : 44 px au doigt, champs à 16 px pour éviter le zoom d'iOS. */
@media (pointer: coarse) {
  :root { --target: 44px; }
  .input { height: 44px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .segmented label { min-height: 44px; }
}
@media (max-width: 640px) {
  :root { --target: 44px; }
  .input, textarea.input { font-size: 16px; }
  .input { height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
