/* Portail Smile Operator : coque (en-tête, onglets, outils), vues Liste et Récurrences,
   panneaux en trou noir, menu, message et connexion. Charger après base.css. */

/* ------------------------------------------------------------- En-tête */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, var(--safe-top)) var(--pad-right) 10px var(--pad-left); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: var(--target); font-size: 19px; font-weight: 600; letter-spacing: -.6px; text-decoration: none; border-radius: 7px; }
.brand-mark { display: block; width: 24px; height: 24px; flex: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sync-state { display: inline-flex; align-items: center; gap: 7px; min-width: 0; margin: 0 8px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sync-text { overflow: hidden; text-overflow: ellipsis; }
.user-name { margin: 0 4px 0 8px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.logout-form { margin: 0; display: flex; }
#sound-toggle .sound-on, #sound-toggle[aria-pressed="true"] .sound-off { display: none; }
#sound-toggle[aria-pressed="true"] .sound-on { display: block; }

/* ------------------------------------------------- Onglets (provider-tab) */
.tabs { display: flex; gap: 4px; padding: 4px var(--pad-right) 0 var(--pad-left); }
.provider-tab { flex: 1 1 0; min-width: 0; max-width: 220px; height: 40px; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.provider-tab:hover { background: var(--hover); color: var(--ink); }
.provider-tab[aria-selected="true"] { background: var(--selected); color: var(--ink); }
.tab-count { color: var(--muted); font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }
.tab-count:empty { display: none; }

/* ------------------------------------------------------------ Outils */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px var(--pad-right) 12px var(--pad-left); }
.toolbar-project { width: auto; min-width: 0; max-width: 280px; height: var(--target); flex: 0 1 auto; padding: 0 30px 0 10px; font-size: 13.5px; }
.toolbar #new-task { margin-left: auto; }
.view { padding: 0 var(--pad-right) calc(24px + var(--safe-bottom)) var(--pad-left); }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.view-intro { margin: 0; max-width: 620px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.view-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.view-empty { margin: 40px 0; color: var(--muted); text-align: center; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
.field-inline > span { color: var(--muted); font-weight: 400; }
.field-inline .input { width: auto; }

/* --------------------------------------------------------- Vue Liste */
.task-list, .rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 10px 10px 12px; border-radius: 9px; }
.list-row:hover { background: var(--hover); }
.list-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 0; text-align: left; border-radius: 6px; }
.list-title { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 14px; font-weight: 500; }
.list-title .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row[data-status="terminee"] .list-title .t { color: var(--muted); }
.list-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; color: var(--subtle); font-size: 12px; }
.list-next { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-actions { display: flex; align-items: center; gap: 6px; }
.rule-row[data-enabled="false"] .list-title .t { color: var(--muted); }
.rule-paused { color: var(--amber); }

/* ------------------------------------------------------------ Message */
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(16px + var(--safe-bottom)); width: max-content; max-width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 12px; background: #101113; box-shadow: inset 0 0 0 1px var(--selected), 0 14px 40px rgba(0, 0, 0, .65); transform: translateX(-50%); animation: toast-in 220ms cubic-bezier(.22, 1, .36, 1); }
.toast-text { margin: 0; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.toast[data-error="true"] .toast-text { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* -------------------------------------- Panneaux : ouverture en trou noir
   Repris de panel.css : un disque noir naît au centre et couvre la page, puis le panneau
   apparaît. La fermeture efface le panneau et résorbe le disque. Seuls transform et opacité
   sont animés. data-presence="in" est posé par portal.js après showModal(). */
.hole { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: hidden; }
.hole[open] { display: flex; align-items: center; justify-content: center; }
.hole::backdrop { background: transparent; }
.hole::before { content: ""; position: fixed; left: 50%; top: 50%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; border-radius: 50%; background: var(--black); box-shadow: 0 0 0 1px var(--selected); pointer-events: none; transform: scale(0); transition: transform 260ms cubic-bezier(.45, 0, .55, 1) 60ms; }
.hole[data-presence="in"]::before { transform: scale(1); transition: transform 520ms cubic-bezier(.7, 0, .2, 1); }
.hole .panel { position: relative; display: flex; flex-direction: column; width: min(580px, calc(100% - 32px)); max-height: calc(100% - 48px); background: var(--black); border: 1px solid var(--selected); border-radius: 20px; overflow: hidden; opacity: 0; transition: opacity 110ms ease-in; }
.hole[data-presence="in"] .panel { opacity: 1; transition: opacity 240ms ease-out 360ms; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 12px 21px; }
.panel-title { margin: 0; min-width: 0; font-size: 17px; font-weight: 600; letter-spacing: -.3px; overflow-wrap: anywhere; }
.panel-form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 4px 21px 18px; }
.panel-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 21px 16px; border-top: 1px solid var(--hover); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-feedback { min-height: 0; margin: 0; font-size: 12.5px; color: var(--red); overflow-wrap: anywhere; }
.form-feedback:empty { display: none; }
.segmented-status label { justify-content: flex-start; padding-left: 12px; }
.task-facts { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--selected); }
.facts { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 12.5px; line-height: 1.55; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.facts-agents { display: flex; flex-wrap: wrap; gap: 5px; }

/* -------------------------------------------- Menu « Déplacer vers… » */
.menu { position: fixed; z-index: 55; min-width: 210px; max-width: calc(100% - 24px); padding: 5px; border-radius: 11px; background: #0c0d0f; box-shadow: inset 0 0 0 1px var(--selected), 0 18px 44px rgba(0, 0, 0, .7); animation: menu-in 150ms cubic-bezier(.22, 1, .36, 1); }
.menu-label { margin: 0; padding: 6px 10px 4px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 10px; border-radius: 7px; font-size: 13.5px; text-align: left; color: var(--ink); }
.menu-item:hover, .menu-item:focus-visible { background: var(--selected); outline: none; }
.menu-item[aria-disabled="true"] { color: var(--muted); cursor: default; }
.menu-item[aria-disabled="true"]:hover { background: transparent; }
.menu-item .menu-current { margin-left: auto; color: var(--subtle); font-size: 11.5px; }
.menu-separator { height: 1px; margin: 5px 4px; background: var(--selected); border: 0; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ Connexion */
.page-login { display: grid; place-items: center; padding: max(24px, var(--safe-top)) var(--pad-right) max(24px, var(--safe-bottom)) var(--pad-left); }
.login { width: 100%; max-width: 380px; }
.login-panel { display: flex; flex-direction: column; gap: 14px; padding: 28px 24px 22px; border: 1px solid var(--selected); border-radius: 20px; background: var(--black); animation: login-in 520ms cubic-bezier(.22, 1, .36, 1); }
.login-mark { width: 48px; height: 48px; margin: 0 0 4px; }
.login-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.6px; }
.login-intro, .login-note { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.login-note { font-size: 12px; color: var(--subtle); }
.login-error { margin: 0; padding: 9px 11px; border-radius: 8px; background: rgba(255, 141, 151, .08); color: var(--red); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.login-submit { min-height: 44px; margin-top: 4px; font-size: 14px; }
@keyframes login-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------- Téléphone */
@media (max-width: 899px) {
  .user-name { display: none; }
}
@media (max-width: 640px) {
  .app-header { padding-top: max(10px, var(--safe-top)); padding-bottom: 4px; }
  .brand { font-size: 17px; }
  .sync-state { margin-right: 2px; }
  .sync-text { display: none; }
  .tabs { padding-top: 0; }
  .provider-tab { height: 44px; max-width: none; padding: 0 6px; font-size: 13.5px; }
  .toolbar { flex-wrap: nowrap; gap: 6px; padding-top: 10px; padding-bottom: 10px; }
  .toolbar-project { flex: 1 1 auto; max-width: none; }
  .toolbar #new-task { padding: 0 12px; min-height: var(--target); }
  .list-row { grid-template-columns: minmax(0, 1fr); padding: 12px 4px; border-bottom: 1px solid var(--hover); border-radius: 0; }
  .list-actions { justify-content: flex-start; }
  .list-actions .secondary-button { min-height: 40px; }
  .view-head { align-items: stretch; flex-direction: column; }
  .view-head .secondary-button { min-height: 44px; }
  .field-inline { justify-content: space-between; }
  /* Panneau plein écran, zones sûres comprises. */
  .hole .panel { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; padding: var(--safe-top) var(--safe-right) 0 var(--safe-left); }
  .panel-header { padding: 12px 8px 8px var(--gutter); }
  .panel-body { padding: 4px var(--gutter) 18px; }
  .panel-footer { padding: 10px var(--gutter) max(12px, var(--safe-bottom)); }
  .panel-footer .secondary-button { flex: 1; min-height: 46px; font-size: 14px; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .segmented-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-item { min-height: 44px; font-size: 14.5px; }
}
@media (max-width: 380px) {
  .toolbar #new-task { font-size: 0; gap: 0; width: var(--target); padding: 0; }
  .toolbar #new-task svg { width: 18px; height: 18px; }
}
