/*
  ZenShareDialog (TO-59, pitch C3 / U4): share one brief with colleagues.

  Its own stylesheet, like tomo-banner.css. The backdrop carries .tomo-face, so every token below
  (and the dark palette) comes from tomo-face.css; the .tomo-face pane layout is undone here,
  because the dialog floats over the host's page. No dark rules of its own: tokens only.

  Hosts include it after tomo-face.css:
    <link rel="stylesheet" href="_content/Tomo.Face/tomo-share.css" />
*/

.zen-share.tomo-face {
  position: fixed;
  inset: 0;
  z-index: 1000;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: auto;
  padding: var(--tomo-space-4);
  container-type: normal;
  background: color-mix(in srgb, var(--tomo-canvas) 55%, rgba(10, 14, 20, 0.55));
  font-size: 14px;
  line-height: 1.5;
}

.zen-share__dialog {
  box-sizing: border-box;
  width: min(460px, 100%);
  max-height: calc(100dvh - 2 * var(--tomo-space-4));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--tomo-surface-elevated);
  border: 1px solid var(--tomo-border-light);
  border-radius: var(--tomo-radius-lg);
  box-shadow: 0 24px 60px rgba(10, 14, 20, 0.28);
  color: var(--tomo-text-primary);
}

.zen-share__head {
  display: flex;
  align-items: center;
  gap: var(--tomo-space-2);
  padding: 14px var(--tomo-space-4);
  border-bottom: 1px solid var(--tomo-border-subtle);
}

.zen-share__icon { display: inline-flex; color: var(--tomo-accent); }
.zen-share__icon svg { width: 18px; height: 18px; }

.zen-share__title { margin: 0; font-size: 16px; font-weight: 700; }

.zen-share__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--tomo-space-4);
  overflow-y: auto;
}

.zen-share__line { margin: 0; font-size: 13.5px; color: var(--tomo-text-secondary); line-height: 1.55; }
.zen-share__line b { color: var(--tomo-text-primary); }

.zen-share__label {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tomo-text-muted);
}

.zen-share__pills { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }

.zen-share__empty { font-size: 13px; font-style: italic; color: var(--tomo-text-muted); }

.zen-share__pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 2px 0 12px;
  border-radius: var(--tomo-radius-full);
  background: var(--tomo-accent-subtle);
  border: 1px solid color-mix(in srgb, var(--tomo-accent) 40%, transparent);
  color: var(--tomo-text-primary);
  font-size: 12.5px;
  font-weight: 700;
}

/* Added here, not yet sent: dashed until Share is pressed. */
.zen-share__pill--new { border-style: dashed; }

.zen-share__pill-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--tomo-radius-full);
  background: transparent;
  color: var(--tomo-text-secondary);
  cursor: pointer;
}

.zen-share__pill-x svg { width: 12px; height: 12px; }
.zen-share__pill-x:hover:not(:disabled) { background: color-mix(in srgb, var(--tomo-accent) 18%, transparent); }
.zen-share__pill-x:disabled { opacity: 0.5; cursor: not-allowed; }

.zen-share__confirm {
  display: flex;
  flex-direction: column;
  gap: var(--tomo-space-2);
  margin-top: 10px;
  padding: var(--tomo-space-3);
  border: 1px solid var(--tomo-danger-line);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-danger-bg);
}

.zen-share__confirm-q { font-size: 14px; font-weight: 700; }
.zen-share__confirm-line { margin: 0; font-size: 12.5px; color: var(--tomo-text-secondary); }
.zen-share__confirm-actions { display: flex; flex-wrap: wrap; gap: var(--tomo-space-2); }

.zen-share__remove {
  border: 1px solid transparent;
  background: var(--tomo-danger-ink);
  color: var(--tomo-on-danger);
}

.zen-share__check {
  display: flex;
  align-items: center;
  gap: var(--tomo-space-2);
  font-size: 13px;
  color: var(--tomo-text-primary);
  cursor: pointer;
}

.zen-share__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--tomo-accent); }

.zen-share__people { display: flex; flex-direction: column; gap: 6px; }

.zen-share__person {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tomo-touch);
  padding: 7px 10px;
  border: 1px solid var(--tomo-border-light);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--tomo-duration-fast) var(--tomo-ease-out),
    border-color var(--tomo-duration-fast) var(--tomo-ease-out);
}

.zen-share__person:hover:not(:disabled) { background: var(--tomo-surface-sunken); }
.zen-share__person:disabled { cursor: default; }

.zen-share__person--added {
  border-color: color-mix(in srgb, var(--tomo-accent) 55%, transparent);
  background: var(--tomo-accent-subtle);
}

.zen-share__person--added:hover:not(:disabled) { background: var(--tomo-accent-subtle); }

.zen-share__avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--tomo-radius-full);
  background: var(--tomo-surface-sunken);
  color: var(--tomo-text-secondary);
  font-size: 11px;
  font-weight: 800;
}

.zen-share__who { display: flex; flex-direction: column; min-width: 0; }
.zen-share__name { font-size: 13.5px; font-weight: 600; }
.zen-share__role { font-size: 12px; color: var(--tomo-text-muted); }
/* TO-188: Tezai's nameHint, its own muted line under a name another member shares ("ZenAI sign-in"). */
.zen-share__hint { font-size: 12px; color: var(--tomo-text-muted); }

.zen-share__add { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--tomo-accent); }
.zen-share__person--added .zen-share__add { color: var(--tomo-text-primary); }

.zen-share__notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--tomo-accent) 30%, transparent);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-accent-subtle);
  font-size: 13px;
  line-height: 1.55;
}

.zen-share__notice p { margin: 0; }
.zen-share__notice-icon { display: inline-flex; flex: none; margin-top: 2px; color: var(--tomo-accent); }
.zen-share__notice-icon svg { width: 16px; height: 16px; }

.zen-share__error {
  margin: 0;
  padding: var(--tomo-space-2) var(--tomo-space-3);
  border: 1px solid var(--tomo-danger-line);
  border-radius: var(--tomo-radius-sm);
  background: var(--tomo-danger-bg);
  color: var(--tomo-danger-ink);
  font-size: 13px;
}

.zen-share__done {
  display: flex;
  align-items: center;
  gap: var(--tomo-space-2);
  margin: 0;
  color: var(--tomo-ok);
  font-size: 13px;
  font-weight: 600;
}

.zen-share__done svg { width: 16px; height: 16px; flex: none; }

.zen-share__mock {
  display: flex;
  align-items: center;
  gap: var(--tomo-space-2);
  padding: 6px 10px;
  border: 1px dashed var(--tomo-warn-line);
  border-radius: var(--tomo-radius-sm);
  background: var(--tomo-warn-bg);
  color: var(--tomo-warn-ink);
  font-size: 12.5px;
}

.zen-share__mock svg { width: 14px; height: 14px; flex: none; }

.zen-share__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: var(--tomo-space-3) var(--tomo-space-4);
  border-top: 1px solid var(--tomo-border-subtle);
}

.zen-share__foot .tomo-btn { min-height: 40px; }
.zen-share__fear { margin-left: auto; font-size: 12px; color: var(--tomo-text-muted); }

/* ── TO-69: the connection share sheet ─────────────────────────────── */

.zen-share__pill--waiting { border-color: var(--tomo-warn-line); background: var(--tomo-warn-bg); }

.zen-share__waiting {
  padding: 1px 7px;
  border-radius: var(--tomo-radius-full);
  background: color-mix(in srgb, var(--tomo-warn-ink) 14%, transparent);
  color: var(--tomo-warn-ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.zen-share__verbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.zen-share__verb {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--tomo-touch);
  padding: 8px 10px;
  border: 1px solid var(--tomo-border-light);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-surface);
  color: var(--tomo-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--tomo-duration-fast) var(--tomo-ease-out),
    border-color var(--tomo-duration-fast) var(--tomo-ease-out);
}

.zen-share__verb:hover:not(:disabled) { background: var(--tomo-surface-sunken); }
.zen-share__verb:disabled { cursor: default; opacity: 0.7; }
.zen-share__verb:focus-visible { outline: 2px solid var(--tomo-accent); outline-offset: 2px; }

.zen-share__verb--on,
.zen-share__verb--on:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--tomo-accent) 55%, transparent);
  background: var(--tomo-accent-subtle);
}

.zen-share__verb-name { font-size: 13.5px; font-weight: 700; }
.zen-share__verb-line { font-size: 12px; color: var(--tomo-text-muted); }

.zen-share__radius {
  display: flex;
  flex-direction: column;
  gap: var(--tomo-space-2);
  padding: 10px 12px;
  border: 1px solid var(--tomo-border-light);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-surface-sunken);
}

.zen-share__radius-head { font-size: 12.5px; font-weight: 700; color: var(--tomo-text-secondary); }
.zen-share__radius .zen-share__empty { margin: 0; }
.zen-share__radius-note { margin: 0; font-size: 12.5px; color: var(--tomo-warn-ink); }

.zen-share__ops { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.zen-share__op { display: flex; align-items: baseline; gap: var(--tomo-space-2); font-size: 13px; }

.zen-share__op-verb {
  flex: none;
  min-width: 44px;
  padding: 1px 6px;
  border-radius: var(--tomo-radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.zen-share__op-verb--read { background: var(--tomo-accent-subtle); color: var(--tomo-accent); }
.zen-share__op-verb--write { background: var(--tomo-warn-bg); color: var(--tomo-warn-ink); }

/* ZenInstallConsent (TO-79): every read and write a connector can make, one plain line each.
   Writes are the riskier group: a warm rule down the side and a warning mark on the heading. */
.zen-install__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--tomo-border-light);
}

.zen-install__group--write { border-left-color: var(--tomo-warn-line); }

.zen-install__head { display: flex; flex-direction: column; gap: 1px; margin: 0; font-size: inherit; font-weight: inherit; }
.zen-install__kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--tomo-text-primary); }
.zen-install__group--write .zen-install__kind { color: var(--tomo-warn-ink); }
.zen-install__kind-line { font-size: 12px; color: var(--tomo-text-muted); }
.zen-install__warn { display: inline-flex; }
.zen-install__warn svg { width: 13px; height: 13px; }

.zen-install__ops { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.zen-install .zen-share__empty { margin: 0; }
.zen-install__op { font-size: 13.5px; color: var(--tomo-text-primary); line-height: 1.45; }

@media (max-width: 480px) {
  .zen-share.tomo-face { align-items: flex-end; padding: 0; }
  .zen-share__dialog { width: 100%; border-radius: var(--tomo-radius-lg) var(--tomo-radius-lg) 0 0; }
  .zen-share__foot { flex-direction: column; align-items: stretch; }
  .zen-share__fear { margin-left: 0; order: -1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .zen-share__person, .zen-share__verb { transition: none; }
}

/*
  ZenConnectorEditor (TO-78, P26): the New connector sheet. It rides the share sheet's backdrop,
  dialog, head, body and foot; only its own rows are styled here. Tokens only, so dark mode follows.
*/
.zen-cedit__dialog { width: min(560px, 100%); }
.zen-cedit__close {
  margin-left: auto;
  padding: 2px 8px;
  border: 0;
  background: none;
  color: var(--tomo-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.zen-cedit__close:hover { color: var(--tomo-text-primary); }
.zen-cedit__field { display: flex; flex-direction: column; gap: 4px; }
.zen-cedit__field > .zen-share__label { margin-bottom: 0; }
.zen-cedit__input { width: 100%; flex: 1 1 160px; box-sizing: border-box; }
/* TO-78 stage fix: inside a column field the flex basis is a HEIGHT, so Name and Base URL grew to
   160px tall and, with padding outside 100%, ran past the sheet. A field input keeps its row height. */
.zen-cedit__field > .zen-cedit__input { flex: 0 0 auto; }
.zen-cedit__row, .zen-cedit__add { display: flex; flex-wrap: wrap; gap: var(--tomo-space-2); align-items: center; }
.zen-cedit__add { margin-top: var(--tomo-space-2); }
.zen-cedit__file { display: flex; flex-direction: column; gap: 4px; margin-top: var(--tomo-space-2); font-size: 12px; color: var(--tomo-text-secondary); }
.zen-cedit__empty { margin: 0; font-size: 13px; color: var(--tomo-text-muted); }
.zen-cedit__ops { margin: 0; padding: 0; list-style: none; border: 1px solid var(--tomo-border-subtle); border-radius: var(--tomo-radius-md); }
.zen-cedit__op { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--tomo-border-subtle); }
.zen-cedit__op:first-child { border-top: 0; }
.zen-cedit__op[data-confirmed="true"] { background: color-mix(in srgb, var(--tomo-success) 6%, transparent); }
.zen-cedit__op-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; min-width: 0; }
.zen-cedit__op-name { font-weight: 600; font-size: 13.5px; }
.zen-cedit__op-path { font-family: var(--tomo-font-mono, ui-monospace, monospace); font-size: 12px; color: var(--tomo-text-muted); overflow-wrap: anywhere; }
.zen-cedit__verb {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--tomo-border-strong);
  font-size: 11px;
  font-weight: 700;
  color: var(--tomo-text-secondary);
}
.zen-cedit__verb--delete { border-color: var(--tomo-danger); color: var(--tomo-danger); }
.zen-cedit__op-grade { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.zen-cedit__select {
  height: 32px;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid var(--tomo-border-strong);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-surface);
  color: var(--tomo-text-primary);
  font: inherit;
  font-size: 12.5px;
}
.zen-cedit__confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.zen-cedit__confirm input { width: 16px; height: 16px; accent-color: var(--tomo-success); }
.zen-cedit__error { margin: 0; font-size: 12.5px; color: var(--tomo-danger); }
.zen-cedit__error--form { flex-basis: 100%; }
.zen-cedit__progress { font-size: 12px; color: var(--tomo-text-muted); }
.zen-cedit__acts { display: flex; gap: 10px; margin-left: auto; }
.zen-cedit__select:focus-visible, .zen-cedit__confirm input:focus-visible, .zen-cedit__close:focus-visible { outline: 2px solid var(--tomo-accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .zen-cedit__acts { margin-left: 0; width: 100%; }
  .zen-cedit__acts .tomo-btn { flex: 1; }
}
