/* The new look's pages for people who connect an agent app (Bloom ticket
   14): connecting an app, /me and its inboxes, a conversation and several
   side by side, deleting conversations, the wake link and the notices.
   On top of /bloom/style.css, whose colours, type, buttons, cards and tiles
   they use. Every class here starts me-, so nothing here reaches another
   page. No inline style.

   1. Shell: header, page, foot
   2. Parts: notes, fields, rows, empty cards
   3. Connect an app
   4. Your inboxes, and one inbox
   5. A conversation, and side by side
   6. Phone */

/* 1. Shell -------------------------------------------------------------- */

.me-site { display: flex; flex-direction: column; min-height: 100vh; }
.me-hd { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 18px 40px;
         border-bottom: 1px solid var(--line); background: var(--surface); }
.me-brand { margin-right: 4px; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.me-sep { color: var(--line); }
.me-hd > a:not(.me-brand) { font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.me-hd > span[aria-current] { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.me-who { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me-who span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.me-main { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 760px; margin: 0 auto;
           padding: 40px 24px 64px; }
.me-main.wide { max-width: 820px; }
.me-main.narrow { max-width: 640px; }
.me-main.full { max-width: 1240px; }
.me-main h1 { font-size: 30px; font-weight: 800; overflow-wrap: anywhere; }
.me-main > p, .me-main > span { overflow-wrap: anywhere; }
.me-lead { color: var(--muted); font-size: 15px; }
.me-site .muted, .me-connect .muted { color: var(--muted); font-size: 13px; }
.me-site code, .me-connect code { font-family: var(--mono); font-size: .92em; }
.me-fine { color: var(--muted); font-size: 12px; }
.me-center { text-align: center; }

/* 2. Parts -------------------------------------------------------------- */

/* A line saying how something stands: good, or a warning. */
.me-note { width: 100%; padding: 14px 18px; border-radius: 14px; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.me-note.good { background: var(--good-soft); }
.me-note.warn { background: var(--warn-soft); }
.me-note b { font-weight: 700; }

/* Buttons in a row; a button that deletes. */
.me-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.me-danger { border-color: var(--warn); background: var(--warn); color: var(--surface); }
.me-acts a.quiet { display: inline-flex; align-items: center; text-decoration: none; }

/* Google's own button. */
.me-gsi { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 20px; border: 1px solid var(--muted);
          border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px;
          text-decoration: none; white-space: nowrap; }
.me-gsi svg { stroke: none; }
.me-gsi:hover { opacity: 1; background: var(--bg); }

/* A field: its name over it. */
.me-form { display: flex; flex-direction: column; align-items: stretch; gap: 14px; width: 100%; }
.me-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.me-field input, .me-field select, .me-stores { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--ink); font: 400 15px/1.4 var(--font); }
.me-field input[readonly] { background: var(--bg); color: var(--muted); }
.me-field input:focus, .me-field select:focus, .me-stores:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

/* A name and a line under it. */
.me-c { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.me-c > b { font-size: 15px; font-weight: 600; }
.me-tile { width: 36px; height: 36px; border-radius: 12px; font-size: 15px; }
.me-tile.big { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }

/* Nothing yet: the empty card's mark in the inbox's colour. */
.me-empty h1, .me-empty h2 { font-size: 22px; font-weight: 700; }
.me-empty p { max-width: 440px; font-size: 15px; }
.me-empty .glyph { background: var(--soft); color: var(--accent); }
.me-empty .glyph.warn { background: var(--warn-soft); color: var(--warn); }

/* 3. Connect an app ----------------------------------------------------- */

.me-connect { display: flex; flex-direction: column; min-height: 100vh; }
.me-connect-col { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 520px; margin: 0 auto;
                  padding: 56px 24px 32px; }
.me-card { align-items: stretch; gap: 18px; padding: 32px; }
.me-card h1 { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.me-card > p { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.me-card > p.muted { font-size: 13px; }
.me-card > p b { color: var(--ink); font-weight: 600; }
.me-card .muted a { color: var(--muted); }
.me-below { color: var(--muted); font-size: 13px; text-align: center; }

/* The app and hellobolo, side by side. */
.me-pair { display: flex; align-items: center; justify-content: center; gap: 14px; }
.me-app, .me-at { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px;
                  border-radius: 16px; font-size: 22px; font-weight: 800; }
.me-app { background: color-mix(in srgb, var(--c1) var(--tint), transparent); color: var(--c1); }
.me-at { background: var(--accent); color: var(--on-accent); }
.me-dots { display: flex; gap: 4px; }
.me-dots i { width: 5px; height: 5px; border-radius: 999px; background: var(--line); }

/* The inboxes to pick from: the one picked outlined in blue. */
.me-pick { display: flex; flex-direction: column; gap: 18px; }
.me-pick fieldset { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.me-pick legend { margin-bottom: 10px; padding: 0; }
.me-opt { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
          background: var(--surface); }
.me-opt:has(input[type=radio]:checked) { padding: 13px; border: 2px solid var(--accent); background: var(--soft); }
.me-opt > label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.me-opt input[type=radio] { flex: none; margin: 3px 0 0; accent-color: var(--accent); }
.me-fields { display: flex; flex-direction: column; gap: 10px; padding-left: 26px; }
.me-fields .me-field { font-weight: 500; }
.me-acts .btn[disabled] { opacity: .6; cursor: default; }

/* 4. Your inboxes, and one inbox ----------------------------------------- */

/* The inboxes: a card each, linking to its page. */
.me-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.me-inbox { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r);
            background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.me-inbox .me-tile { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }
.me-inbox .me-c > b { font-size: 16px; font-weight: 700; }
.me-inbox .me-c > b .muted { font-size: 16px; font-weight: 500; }
.me-chev { color: var(--muted); font-size: 20px; }

/* One inbox: its name and handle, then its cards. */
.me-head { display: flex; align-items: center; gap: 16px; }
.me-head h1 { font-size: 28px; }
.me-head .muted { font-size: 14px; }

/* The webhook, or a wake-check address: what it does, and Remove. */
.me-row-card { flex-direction: row; align-items: center; gap: 12px; width: 100%; padding: 18px; }
.me-row-card .me-c .muted b { color: var(--ink); font-weight: 600; }

/* More ways to listen: folded, then the form to wake an app. */
.me-more { display: block; width: 100%; padding: 0; }
.me-more > summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-size: 15px; font-weight: 600;
                     list-style: none; cursor: pointer; }
.me-more > summary::-webkit-details-marker { display: none; }
.me-more > summary svg { margin-left: auto; color: var(--muted); }
.me-more[open] > summary svg { transform: rotate(180deg); }
.me-more-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 24px 24px; }
.me-more-body > p { font-size: 14px; }

/* Conversations and apps: a card each, a row each, ruled. */
.me-list-card { width: 100%; align-items: stretch; gap: 8px; }
.me-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.me-bar .me-acts { margin-left: auto; }
.me-rows { list-style: none; margin: 0; padding: 0; }
.me-rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.me-rows li:first-child { margin-top: 8px; }
.me-rows input[type=checkbox] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.me-rows .me-c > a { color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
.me-rows .me-c > a:hover { text-decoration: underline; }
.me-wake { display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; margin-top: 4px; }
.me-wake .muted { flex: 1 1 260px; font-size: 12px; }
.me-stores { margin-top: 4px; }
.me-list-card .me-fine { margin-top: 4px; }

/* Deleting: the conversations by name, then Delete or Cancel. */
.me-confirm { align-items: stretch; gap: 16px; }
.me-names { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.me-names li { display: flex; align-items: center; gap: 10px; }
.me-names .me-tile { width: 32px; height: 32px; font-size: 14px; border-radius: 10px; }
.me-confirm p { font-size: 14px; }

/* 5. A conversation, and side by side ------------------------------------ */

/* A card: who it's with over the messages, as watch.mjs draws them. */
.me-chat { align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.me-chat [hidden] { display: none; }
.me-chat-hd { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.me-back { color: var(--muted); font-size: 22px; line-height: 1; text-decoration: none; }
.me-chat-who { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; flex: 1; min-width: 0; }
.me-chat-who > b { display: inline-flex; align-items: center; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.me-chat-who > span { flex-basis: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.me-as { flex: none; max-width: 40%; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-chat-note { margin: 16px 20px; color: var(--muted); font-size: 14px; text-align: center; }

.me-log { max-height: calc(100vh - 260px); min-height: 240px; overflow-y: auto; padding: 8px 20px 20px; }
.me-msgs { list-style: none; display: flex; flex-direction: column; margin: 0; padding: 0; }
.me-earlier { display: block; margin: 8px auto; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
              background: var(--surface); color: var(--muted); font: 500 13px/1 var(--font); cursor: pointer; }

/* What watch.mjs draws inside: each entry, its bubble, who sent it, the
   one it answers, the time between, and how it went. */
.me-msgs .entry { display: flex; flex-direction: column; }
.me-msgs .entry.mine { align-items: flex-end; }
.me-msgs .entry.theirs { align-items: flex-start; }
.me-msgs .message { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; margin-top: 10px; }
.me-msgs .message.more { margin-top: 4px; }
.me-msgs .bubble { min-width: 0; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5;
                   white-space: pre-wrap; overflow-wrap: anywhere; }
.me-msgs .mine .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.me-msgs .mine .bubble a { color: inherit; }
.me-msgs .theirs .bubble { border: 1px solid var(--line); background: var(--bg); border-bottom-left-radius: 6px; }
.me-msgs .time { align-self: center; margin: 16px 0 2px; color: var(--muted); font-size: 12px; }
.me-msgs .sender, .me-msgs .re { max-width: 78%; margin: 12px 4px -6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.me-msgs .status { margin: 4px 4px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.me-msgs .status.failed { color: var(--warn); font-weight: 600; }
.me-msgs .avatar-gap { width: 28px; flex: none; }
.me-chat.grouped .entry.theirs .sender, .me-chat.grouped .entry.theirs .re { margin-left: 40px; }

/* Faces: the first letter, or the picture someone set. */
.me-chat .avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
                   width: 28px; height: 28px; overflow: hidden; border-radius: 999px; background: var(--c);
                   color: #fff; font-size: 13px; font-weight: 700; }
.me-chat .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.me-chat .avatar.c0 { --c: var(--c1); } .me-chat .avatar.c1 { --c: var(--c3); } .me-chat .avatar.c2 { --c: var(--c2); }
.me-chat .avatar.c3 { --c: var(--c6); } .me-chat .avatar.c4 { --c: var(--c0); } .me-chat .avatar.c5 { --c: var(--c5); }
.me-chat .avatar.c6 { --c: var(--c4); } .me-chat .avatar.c7 { --c: var(--ask); }
.me-chat-who .faces { display: flex; }
.me-chat-who .faces[hidden] { display: none; }
.me-chat-who .faces .avatar { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--surface); }
.me-chat-who .faces .avatar + .avatar { margin-left: -8px; }
.me-chat .verified { width: 16px; height: 16px; margin-left: 6px; stroke: none; }
.me-chat .verified circle { fill: var(--accent); }
.me-chat .verified path { fill: none; stroke: var(--on-accent); stroke-width: 1.8; }

/* Side by side: a card each, filling the width. */
.me-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.me-board .me-log { max-height: calc(100vh - 240px); }

/* 6. Phone -------------------------------------------------------------- */

@media (max-width: 720px) {
  .me-hd { padding: 14px 20px; }
  .me-who { flex-basis: 100%; margin-left: 0; justify-content: space-between; }
  .me-main { padding: 24px 16px 48px; gap: 16px; }
  .me-main h1, .me-head h1 { font-size: 24px; }
  .me-connect-col { padding: 24px 16px; }
  .me-card { padding: 24px 20px; }
  .me-head .me-tile.big { width: 48px; height: 48px; font-size: 20px; }
  .me-bar .me-acts { margin-left: 0; }
  .me-row-card { flex-wrap: wrap; }
  .me-more-body { padding: 4px 16px 16px; }
  .me-msgs .message, .me-msgs .sender, .me-msgs .re { max-width: 88%; }
  /* Side by side: one at a time, swiped sideways. */
  .me-board { display: flex; gap: 12px; margin: 0 -16px; padding: 0 16px; overflow-x: auto; scroll-snap-type: x mandatory; }
  .me-board > .me-chat { flex: 0 0 100%; scroll-snap-align: center; }
}
