/* @anchorvane/ui: the look of the shared parts. A site loads it before its own styles.css, which may go over it. */
:root {
  --background: #ffffff;
  --surface: #ffffff;
  --foreground: #171717;
  --muted: #5f6368;
  --border: #d9dbdf;
  --accent: #171717;
  --accent-text: #ffffff;
  --danger: #c5221f;
  --danger-text: #ffffff;
  --danger-soft: rgba(197, 34, 31, 0.1);
  --amber: #b06000;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --success-soft: rgba(30, 142, 62, 0.12);
  --success: #1e8e3e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --surface: #111214;
    --foreground: #ededed;
    --muted: #a1a5ab;
    --border: #2c2e33;
    --accent: #ededed;
    --accent-text: #0a0a0a;
    --danger: #ea4335;
    --danger-text: #ffffff;
    --amber: #fbbc04;
    --success: #5bb974;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: clamp(1rem, calc(0.40625rem + min(1.3vh, 0.8vw)), 1.5rem); }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: Arial, Helvetica, sans-serif; line-height: 1.45; }
a { color: inherit; text-underline-offset: 4px; }
h1 { font-size: 1.6rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--muted); font-size: 0.9rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.field input, .field select { font: inherit; font-size: 1rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); color: var(--foreground); width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--foreground); outline-offset: 1px; }
.button { font: inherit; font-size: 0.95rem; padding: 0.6rem 1rem; border-radius: 0.5rem; border: 1px solid var(--border); background: transparent; color: var(--foreground); cursor: pointer; }
.button:disabled { opacity: 0.55; cursor: default; }
.button-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button-danger { background: var(--danger); color: var(--danger-text); border-color: var(--danger); }
.button-wide { width: 100%; }
.alert { border-radius: 0.5rem; padding: 0.7rem 0.9rem; font-size: 0.92rem; border: 1px solid; }
.alert-error { background: var(--danger-soft); border-color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: var(--success); }
.alert-amber { background: var(--amber-soft); border-color: var(--amber); }
.alert-info { border-color: var(--border); }
.card { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.confirm-panel { border: 1px solid var(--danger); border-radius: 0.5rem; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.75rem; }
.language-choice { display: flex; gap: 0.5rem; }
.link-button { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.link-button[aria-current='true'] { font-weight: 700; text-decoration: none; }

@media (pointer: coarse) {
  .button, .field input, .field select { min-height: 2.75rem; }
}
.field-small { width: auto; font-size: 0.85rem; padding: 0.3rem 0.5rem; }
.field-label { font-size: 0.85rem; color: var(--muted); }
.code, textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.danger-text { color: var(--danger); }
.payload-builder { display: flex; flex-direction: column; gap: 0.5rem; }
.payload-name { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; overflow-wrap: anywhere; }
.payload-add { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.payload-add input.field { flex: 1; min-width: 7rem; width: auto; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 20; }
.modal { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(46rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
input.field, select.field, textarea.field { font: inherit; font-size: 0.95rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); color: var(--foreground); width: 100%; }
input.field:focus, select.field:focus, textarea.field:focus { outline: 2px solid var(--foreground); outline-offset: 1px; }
.mapping-line, .payload-line { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(0, 1.6fr) auto; gap: 0.4rem; align-items: center; font-size: 0.85rem; }
.field textarea { font: inherit; font-size: 0.95rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); color: var(--foreground); width: 100%; }

/* The conversation screen (approved by the PO, 6 November 2026). */
.icon { display: block; flex: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 0.5rem; background: transparent; color: var(--foreground); cursor: pointer; }
.icon-button:hover { background: rgba(0, 0, 0, 0.06); }
.conversation { position: relative; gap: 1.1rem; }
.conversation-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.messages { display: flex; flex-direction: column; gap: 1.1rem; }
.message { display: flex; flex-direction: column; gap: 0.35rem; }
.message-meta { display: flex; align-items: baseline; gap: 0.5rem; }
.message-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.new-line { display: flex; align-items: center; gap: 0.75rem; color: var(--danger); font-size: 0.82rem; margin: 0.2rem 0 0.6rem; }
.new-line::before, .new-line::after { content: ''; flex: 1; border-top: 1px solid var(--foreground); }
.attachments { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.attachment { position: relative; display: inline-flex; }
.attachment-thumb img { display: block; width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 0.5rem; background: #f1f3f4; }
.attachment-chip { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.7rem 0.9rem; border-radius: 0.6rem; background: #f1f3f4; text-decoration: none; font-size: 0.85rem; max-width: 16rem; }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { position: absolute; top: -0.45rem; right: -0.45rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 0; background: #5f6368; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.attachment-remove .icon { width: 0.8rem; height: 0.8rem; }
.steps-fold { display: inline-flex; align-items: center; gap: 0.3rem; border: 0; background: transparent; padding: 0; color: var(--muted); font: inherit; font-size: 0.9rem; cursor: pointer; align-self: flex-start; }
.steps-fold .icon { width: 0.9rem; height: 0.9rem; }
.steps-box { list-style: none; margin: 0.2rem 0 0; padding: 0.5rem 0.9rem; border: 1px solid var(--border); border-radius: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; align-self: flex-start; font-size: 0.92rem; }
.step { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); }
.step-doing { color: var(--foreground); font-weight: 600; }
.step-todo { opacity: 0.8; }
.step-mark { width: 1rem; display: inline-flex; justify-content: center; }
.step-mark .icon { width: 0.9rem; height: 0.9rem; }
.step-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--foreground); }
.step-ring { width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 1px solid var(--muted); }
.message-box { position: relative; display: flex; flex-direction: column; gap: 0.5rem; }
.message-row { display: flex; align-items: center; gap: 0.5rem; }
.message-input { flex: 1; display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--border); border-radius: 1.6rem; padding: 0.3rem 0.9rem 0.3rem 0.4rem; }
.message-input textarea { flex: 1; border: 0; outline: none; resize: none; font: inherit; background: transparent; color: inherit; padding: 0.45rem 0; max-height: 10rem; }
.send-button { width: 3rem; height: 3rem; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.send-button:disabled { opacity: 0.4; cursor: default; }
.menu-backdrop { position: fixed; inset: 0; z-index: 30; }
.menu { position: absolute; z-index: 31; min-width: 13rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16); padding: 0.4rem; display: flex; flex-direction: column; }
.menu-top-right { top: 0; right: 0; }
.menu-bottom-left { bottom: 3.5rem; left: 0; }
.menu-head { display: flex; justify-content: flex-end; }
.menu-foot { display: flex; justify-content: flex-start; padding-top: 0.2rem; }
.menu-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 0; background: transparent; border-radius: 0.5rem; font: inherit; color: var(--foreground); text-align: left; cursor: pointer; }
.menu-item:hover { background: rgba(0, 0, 0, 0.06); }
.menu-item-danger { color: var(--danger); }
