/* Styles for the Master SOP editor (.me-) and Users admin (.ua-). Uses the variables from style.css. */
:root { --ad-danger: #d33; --ad-danger-soft: #fdecec; --ad-warn-bg: #fff7e0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ad-danger: #ff7b7b; --ad-danger-soft: #3a1c1c; --ad-warn-bg: #2b2412; }
}

.ua-root input, .ua-root select {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.ua-root input:focus, .ua-root select:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
.ua-muted { color: var(--muted); }

/* ---- shared button look ---- */
.ua-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: 14px; line-height: 1.2; cursor: pointer; min-height: 34px; white-space: nowrap;
}
.ua-btn:hover:not(:disabled) { border-color: var(--accent); }
.ua-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.ua-btn:disabled { opacity: .45; cursor: not-allowed; }
.ua-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ua-primary:hover:not(:disabled) { filter: brightness(1.08); }
.ua-danger { background: var(--ad-danger); border-color: var(--ad-danger); color: #fff; font-weight: 600; }
.ua-danger-quiet { color: var(--ad-danger); }
.ua-danger-quiet:hover:not(:disabled) { border-color: var(--ad-danger); }
.ua-small { font-size: 13px; padding: 4px 9px; min-height: 30px; }

.ua-err { background: var(--ad-danger-soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0 0; }
.ua-ok { color: var(--done); background: var(--done-soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0 0; font-size: 14px; }
.ua-lbl { display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); margin: 8px 0 3px; }
.ua-field { display: block; min-width: 0; }
.ua-hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ---- master editor: the client page, editable in place (.me-). Layout comes from client.css / style.css ---- */
.me-root { position: relative; }
.me-info { margin: 0 0 12px; }

/* sticky strip: tabs + save status + notices */
.me-stick .tabs { padding-bottom: 4px; }
.me-stick .tab.me-tab-add { border-style: dashed; color: var(--accent); align-self: stretch; }
.me-stick .tab.me-bad { border-color: var(--danger); }
.me-statusrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.me-statusrow .cv-chip { min-width: 0; }
.me-statusrow .cv-chip-state { overflow-wrap: anywhere; }
.me-notices:empty { display: none; }
.me-conflict { margin: 8px 0 0; border-color: var(--warn); background: var(--warn-soft); }
.me-confirm { margin: 8px 0 0; }
.me-sop > .me-confirm { margin-bottom: 12px; }

/* editable text: looks like the plain text until you hover or focus it */
.me-ed { cursor: text; border-radius: 4px; overflow-wrap: anywhere; }
.me-ed:empty::before { content: attr(data-ph); color: var(--muted); opacity: .7; pointer-events: none; }
@media (hover: hover) { .me-ed:hover:not(:focus) { background: var(--accent-soft); } }
.me-ed:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-ed.me-bad { outline: 2px solid var(--danger); outline-offset: 2px; background: var(--danger-soft); }
.me-root .me-ed { scroll-margin-top: calc(var(--cv-offset, 120px) + 8px); scroll-margin-bottom: 48px; }
.me-sop-title { flex: 1 1 200px; min-width: 0; }
.me-err { color: var(--danger); font-size: 13px; margin: 2px 6px 6px; }
.me-lab + .me-err { margin-left: 42px; }

/* the checkbox is only there so the layout matches the client page */
.me-lab {
  display: flex; gap: 12px; align-items: flex-start; padding: 9px 6px; border-radius: 8px;
}
.me-lab:focus-within { background: var(--accent-soft); }
.me-lab input[type="checkbox"] { pointer-events: none; }
.me-lab .txt { cursor: text; }
.me-t { display: inline; }

/* Watch pill: label inline, URL appears while the pill has focus */
.me-pill { white-space: normal; max-width: 100%; }
.me-link { display: inline; }
.me-link .me-lu { display: none; }
.me-link.is-open .me-lu, .me-link.has-err .me-lu {
  display: inline-block; vertical-align: baseline; max-width: 100%; margin-left: 6px; padding: 1px 8px;
  font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.me-link .me-lu:empty { min-width: 12em; }
.me-link .me-x {
  display: none; margin-left: 4px; padding: 0 3px; border: 0; background: none; color: inherit;
  font: inherit; line-height: 1; cursor: pointer; border-radius: 4px;
}
.me-link.is-open .me-x { display: inline; }
.me-link .me-x:focus-visible { outline: 2px solid var(--accent); }
.me-pill .me-ll { min-width: 2ch; }
.group-links .me-link { display: inline; }

/* small floating controls, shown on hover or while the item / group / checklist has focus */
.me-sop, .me-group, .me-item { position: relative; }
.me-tools {
  position: absolute; z-index: 3; display: flex; gap: 2px; align-items: center; flex-wrap: wrap; visibility: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px; box-shadow: 0 4px 14px rgba(15, 20, 30, .18);
}
.me-item > .me-tools { top: -10px; right: 4px; }
.me-group > .me-tools { top: 6px; right: 8px; }
.me-sop > .me-tools { top: 0; right: 0; }
.me-tb {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; line-height: 1; min-width: 28px; min-height: 28px;
  padding: 4px 7px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.me-tb:hover:not(:disabled), .me-tb:focus-visible { background: var(--accent-soft); color: var(--text); }
.me-tb:focus-visible { outline: 2px solid var(--accent); }
.me-tb:disabled { opacity: .35; cursor: default; }
.me-tb-danger { color: var(--danger); }
.me-sop > .sop-head:hover + .me-tools, .me-sop > .sop-head:focus-within + .me-tools, .me-sop > .me-tools:hover, .me-sop > .me-tools:focus-within,
.me-group:hover:not(:has(.me-item:hover)) > .me-tools, .me-group:focus-within:not(:has(.me-item:focus-within)) > .me-tools,
.me-item:hover:not(:has(.me-item:hover)) > .me-tools, .me-item:focus-within:not(:has(.me-item:focus-within)) > .me-tools { visibility: visible; }

.me-add {
  margin: 4px 0 0; border-style: dashed; color: var(--accent); background: transparent;
}
.me-sop > .me-add { margin-bottom: 8px; }
.me-sop + .me-sop { margin-top: 0; }
.cv-panel > .me-add { display: block; margin-top: 16px; }

@media (max-width: 600px) {
  /* no hover on a phone: the controls open in the flow, below the item that has focus */
  .me-tools { position: static; display: none; visibility: visible; box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 2px 6px 6px; padding: 4px 0 0; }
  .me-sop > .sop-head:hover + .me-tools, .me-sop > .sop-head:focus-within + .me-tools, .me-sop > .me-tools:focus-within,
  .me-group:focus-within:not(:has(.me-item:focus-within)) > .me-tools,
  .me-item:focus-within:not(:has(.me-item:focus-within)) > .me-tools { display: flex; }
  .me-tb { min-height: 34px; }
}
@media (max-width: 480px) {
  /* one slim status line in the sticky strip: the state (cut with an ellipsis if long) and the buttons */
  .me-statusrow { flex-wrap: nowrap; margin-top: 4px; }
  .me-statusrow .cv-chip { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow: hidden; }
  .me-statusrow .cv-chip-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-statusrow .cv-chip-age { display: none; }
  .me-statusrow .btn { flex: none; }
  .me-lab { padding: 11px 4px; }
  .me-lab + .me-err { margin-left: 40px; }
}

/* ---- users admin ---- */
.ua-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ua-head h2 { margin: 0; font-size: 22px; }
.ua-note { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.ua-form, .ua-inline { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.ua-inline { background: var(--accent-soft); border-color: transparent; margin: 10px 0 0; }
.ua-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 12px; }
.ua-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ua-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--ad-danger-soft); }
.ua-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ua-user { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ua-user.is-off { opacity: .85; }
.ua-main { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.ua-who { min-width: 0; flex: 1 1 220px; }
.ua-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; font-size: 16px; }
.ua-email { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.ua-meta { color: var(--muted); font-size: 13px; }
.ua-badge { font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 1px 8px; background: var(--line); color: var(--muted); }
.ua-badge.is-admin { background: var(--accent-soft); color: var(--accent); }
.ua-badge.is-active { background: var(--done-soft); color: var(--done); }
.ua-badge.is-inactive { background: var(--ad-danger-soft); color: var(--ad-danger); }
.ua-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- users admin: sign-in method chips ---- */
.ua-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ua-chip { font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 1px 8px; background: var(--accent-soft); color: var(--accent); }
.ua-chip.is-google { background: var(--done-soft); color: var(--done); }
.ua-chip.is-muted { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }
