/* 11-mail.css - the mail client (Gmail Inside Workspace, Sam, 7 Nov 2026: "copy the layout and look" of Gmail,
   in the kit's own look). Gmail's shape: a rail down the left (Compose, the folders, the inboxes, the labels),
   a search bar over the list, the list one row per conversation (tick, star, sender, labels as chips,
   subject - snippet, time), an unread row in semi-bold. A conversation opens as a column of messages with
   Reply and Forward at its foot. On a phone the rail is a drawer, each row is two lines and Compose floats.
   Everything is inside .gg-mail, drawn from the kit's tokens only, sharp corners, nothing heavier than 600. */
/* Mail fills the window edge to edge like Gmail (Sam, 16 Nov 2026: "make this app full width"), with room to breathe
   around it ("a bit more spacious and smart looking - maybe glass vibes"): the folders, the search and the list each sit on
   the kit's glass panel (.gg-glass), so the background picture shows through */
.page:has(.gg-mail){max-width:none;padding-left:clamp(16px,3vw,48px);padding-right:clamp(16px,3vw,48px)}
.gg-mail{display:grid;grid-template-columns:232px minmax(0,1fr);gap:28px;align-items:start;font-family:var(--ui);color:var(--ink-2)}
.gg-mail svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* the rail */
.gg-mail-rail{position:sticky;top:76px;display:flex;flex-direction:column;gap:2px;padding:14px 10px 16px}
.gg-mail-compose{display:inline-flex;align-items:center;gap:12px;align-self:flex-start;margin:0 0 14px 6px;padding:14px 22px 14px 18px;
  background:var(--primary);color:var(--on-primary);border:0;font:600 15px/1 var(--ui);cursor:pointer;text-decoration:none}
.gg-mail-compose:hover{filter:brightness(1.08)}
.gg-mail-nav{display:flex;align-items:center;gap:14px;padding:8px 12px 8px 14px;color:var(--ink-2);text-decoration:none;font-size:14px;line-height:1.3}
button.gg-mail-nav{font-family:inherit;font-size:14px}
.gg-mail-nav:hover{background:color-mix(in srgb,var(--ink) 7%,transparent)}
button.gg-mail-nav{border:0;background:none;font:inherit;width:100%;text-align:left;cursor:pointer}
button.gg-mail-nav[aria-pressed="true"] svg{color:var(--primary)}
.gg-mail-nav[aria-current="page"],.gg-mail-nav[aria-current="true"]{background:color-mix(in srgb,var(--primary) 18%,transparent);color:var(--ink);font-weight:600}
.gg-mail-nav .n{margin-left:auto;font-size:12px;color:var(--ink-3)}
.gg-mail-nav[aria-current="page"] .n,.gg-mail-nav[aria-current="true"] .n{color:var(--ink)}
.gg-mail-sw{width:10px;height:10px;flex:none;background:var(--c,var(--idle))}
.gg-mail-rail h2{margin:18px 0 6px;padding:0 14px;font:600 12px/1.3 var(--ui);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3)}

/* the search bar and the toolbar over the list */
.gg-mail-main{min-width:0}
.gg-mail-find{display:flex;align-items:center;gap:12px;height:52px;padding:0 20px;margin:0 0 18px;color:var(--ink-3)}
.gg-mail-find:focus-within{border-color:var(--primary)}
.gg-mail-find input{flex:1;min-width:0;height:100%;border:0;background:none;font:400 15px var(--ui);color:var(--ink);outline:0}
.gg-mail-find input::placeholder{color:var(--ink-2);opacity:.8}
.gg-mail-box{min-width:0}
.gg-mail-bar{display:flex;align-items:center;gap:10px;min-height:54px;padding:0 18px;border-bottom:1px solid color-mix(in srgb,var(--ink) 10%,transparent)}
.gg-mail-bar .sp{margin-left:auto;font-size:12.5px;color:var(--ink-3);padding:0 8px;white-space:nowrap}
.gg-mail-ib{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:0;background:none;color:var(--ink-3);cursor:pointer}
.gg-mail-ib:hover{background:color-mix(in srgb,var(--ink) 8%,transparent);color:var(--ink)}
.gg-mail-ib:disabled{opacity:.4;cursor:default;background:none}
.gg-mail-ib[aria-pressed="true"]{color:var(--warn)}
.gg-mail-ib[aria-pressed="true"] svg{fill:currentColor}
.gg-mail input[type=checkbox]{width:16px;height:16px;margin:0;accent-color:var(--primary);cursor:pointer}

/* the list: one roomy two-line row per conversation - a round initial, the sender and the time, then the subject and a grey
   preview. Calm until pointed at: the tick sits over the initial and the star beside the time, both shown on hover, when
   ticked or starred; on a phone a tap on the initial ticks the row. Unread is bold with a small green dot, read is softer */
.gg-mail-list{list-style:none;margin:0;padding:0}
.gg-mail-row{position:relative;display:grid;grid-template-columns:40px minmax(0,1fr) auto auto;
  grid-template-areas:"av who att when" "av what what star";align-items:center;gap:3px 16px;
  min-height:72px;padding:9px 20px;border-bottom:1px solid color-mix(in srgb,var(--ink) 8%,transparent);font-size:14px;color:var(--ink-3)}
.gg-mail-row:last-child{border-bottom:0}
.gg-mail-row:hover{background:color-mix(in srgb,var(--ink) 6%,transparent)}
.gg-mail-row.is-picked{background:color-mix(in srgb,var(--primary) 16%,transparent)}
.gg-mail-row > a.go{position:absolute;inset:0;z-index:0}
.gg-mail-row > :not(.go){position:relative;z-index:1;pointer-events:none}
.gg-mail-row > .tick,.gg-mail-row > .gg-mail-ib{pointer-events:auto}
.gg-mail-row > .av{grid-area:av;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:var(--c,var(--idle));color:#fff;font:600 16px/1 var(--ui)}
/* the initial's colour, one of eight steady hues picked from the sender's name (data-c="0" to "7") */
.gg-mail .av[data-c="0"]{--c:#3f7d8c}.gg-mail .av[data-c="1"]{--c:#7a5c9e}.gg-mail .av[data-c="2"]{--c:#4f8a4a}.gg-mail .av[data-c="3"]{--c:#a0663a}.gg-mail .av[data-c="4"]{--c:#9e4f6e}.gg-mail .av[data-c="5"]{--c:#4d6fa8}.gg-mail .av[data-c="6"]{--c:#8a8a3c}.gg-mail .av[data-c="7"]{--c:#3f8f7a}
.gg-mail-row.is-failed > .av{--c:color-mix(in srgb,var(--bad) 70%,transparent)}
.gg-mail-row > .tick{grid-area:av;justify-self:center;width:20px;height:20px;opacity:0;z-index:2}
.gg-mail-row:is(:hover,:focus-within,.is-picked) > .tick,.gg-mail-list:has(.tick:checked) .tick{opacity:1}
.gg-mail-row:is(:hover,:focus-within,.is-picked) > .av,.gg-mail-list:has(.tick:checked) .av{opacity:.15}
.gg-mail-row > .who{grid-area:who;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:15px;color:var(--ink-2)}
.gg-mail-row .who .c{margin-left:5px;font-weight:400;font-size:12px;color:var(--ink-3)}
.gg-mail-row > .when{grid-area:when;display:flex;align-items:center;gap:7px;font-size:12.5px;white-space:nowrap;justify-self:end}
.gg-mail-row > .att{grid-area:att;color:var(--ink-3)}
.gg-mail-row > .what{grid-area:what;display:flex;align-items:center;gap:8px;overflow:hidden;white-space:nowrap}
.gg-mail-row .what .s{flex:none;max-width:70%;overflow:hidden;text-overflow:ellipsis;color:var(--ink-2);font-weight:600}
.gg-mail-row .what .p{overflow:hidden;text-overflow:ellipsis;font-weight:400;color:var(--ink-3)}
.gg-mail-row .what .p::before{content:"- "}
.gg-mail-row > .star{grid-area:star;justify-self:end;width:28px;height:28px;opacity:0}
.gg-mail-row:is(:hover,:focus-within) > .star,.gg-mail-row > .star[aria-pressed="true"]{opacity:1}
.gg-mail-row.is-unread > .who{color:var(--ink);font-weight:600}
.gg-mail-row.is-unread .what .s{color:var(--ink)}
.gg-mail-row.is-unread > .when{color:var(--ink);font-weight:600}
.gg-mail-row.is-unread > .when::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--ok);box-shadow:0 0 6px color-mix(in srgb,var(--ok) 60%,transparent)}
.gg-mail-row:not(.is-unread) .what .s{font-weight:400}
/* an email that did not go: its reason, Retry and Delete */
.gg-mail-row > .gg-mail-redo{grid-area:star;display:flex;gap:2px;justify-self:end;pointer-events:auto}
.gg-mail-row > .gg-mail-redo .gg-mail-ib{width:28px;height:28px}
.gg-mail-chip{display:inline-block;flex:none;padding:0 6px;font:400 12px/1.5 var(--ui);color:var(--ink-2);
  background:color-mix(in srgb,var(--c,var(--idle)) 22%,transparent);border:1px solid color-mix(in srgb,var(--c,var(--idle)) 45%,transparent)}
.gg-mail-empty{padding:56px 16px;text-align:center;color:var(--ink-3);font-size:14px}
@media (hover:none){.gg-mail-row > .star{opacity:1}}

/* a conversation */
.gg-mail-thread{background:var(--paper);border:1px solid var(--hair)}
.gg-mail-thread > .bar{display:flex;align-items:center;gap:4px;padding:6px 17px;border-bottom:1px solid var(--hair)}
.gg-mail-thread h1{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:0;padding:18px 24px 14px;font:600 20px/1.3 var(--ui);color:var(--ink)}
.gg-mail-msg{display:grid;grid-template-columns:40px minmax(0,1fr);gap:0 14px;padding:16px 24px 16px 18px;border-bottom:1px solid var(--hair)}
.gg-mail-msg:last-of-type{border-bottom:0}
.gg-mail-av{grid-row:span 2;width:40px;height:40px;display:flex;align-items:center;justify-content:center;
  background:var(--c,var(--primary));color:#fff;font:600 16px/1 var(--ui)}
.gg-mail-msg .from{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;font-size:14px;color:var(--ink)}
.gg-mail-msg .from b{font-weight:600}
.gg-mail-msg .from .addr,.gg-mail-msg .to{font-size:12px;color:var(--ink-3)}
.gg-mail-msg .from .t{margin-left:auto;font-size:12px;color:var(--ink-3);white-space:nowrap}
.gg-mail-msg .body{grid-column:2;margin-top:12px;font-size:14px;line-height:1.6;color:var(--ink-2);overflow-wrap:anywhere}
.gg-mail-msg .body p{margin:0 0 .8em}
.gg-mail-msg .body blockquote{margin:0 0 .8em;padding-left:12px;border-left:2px solid var(--hair);color:var(--ink-3)}
.gg-mail-msg.is-folded .body{display:none}
.gg-mail-msg.is-folded{cursor:pointer}
.gg-mail-msg.is-folded .snip{grid-column:2;font-size:13px;color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gg-mail-msg:not(.is-folded) .snip{display:none}
.gg-mail-files{grid-column:2;display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.gg-mail-file{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--hair);font-size:13px;color:var(--ink-2);text-decoration:none}
.gg-mail-acts{display:flex;flex-wrap:wrap;gap:10px;padding:14px 24px 22px;border-top:1px solid var(--hair)}
.gg-mail-acts .btn-line{gap:8px}

/* a conversation as WhatsApp draws it (Sam, 16 Nov 2026: "the bubbles look shit", with a WhatsApp chat as the model).
   Rounded bubbles are a named exception to sharp corners, asked for by Sam for this one place. Mine green on the right,
   theirs light on the left, each fits its words up to 65% of the column, the first of a run has a small tail at its top
   corner, the time sits small and grey at the bottom right, on the last line when it fits (the bubble keeps room for it
   with an invisible copy, data-meta). Behind them a faint chat paper. Light and dark each have their own colours. */
/* the chat colours come from the theme (Sam, 28 Nov 2026: "like WhatsApp", his own sent emails on the right, the other
   person's on the left, the two sides slightly different colours): ours a soft wash of the theme's green, dimmed in the dark
   theme; theirs the theme's paper; behind them the page's second paper. Any theme or scheme carries through. */
.gg-mail-thread{--wa-bg:var(--paper-2);--wa-dot:color-mix(in srgb,var(--ink) 4.5%,transparent);--wa-in:var(--paper);
  --wa-out:color-mix(in srgb,var(--ok) 22%,var(--paper));--wa-ink:var(--ink);--wa-meta:var(--ink-3);--wa-who:color-mix(in srgb,var(--ok) 70%,var(--ink));
  --wa-day:var(--paper);--wa-shadow:0 1px .5px color-mix(in srgb,var(--ink) 14%,transparent);--wa-link:var(--info)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .gg-mail-thread{--wa-bg:color-mix(in srgb,#000 45%,var(--paper));
  --wa-in:var(--paper-2);--wa-out:color-mix(in srgb,var(--ok) 26%,var(--paper));--wa-shadow:0 1px .5px rgba(0,0,0,.3)}}
:root[data-theme="dark"] .gg-mail-thread{--wa-bg:color-mix(in srgb,#000 45%,var(--paper));
  --wa-in:var(--paper-2);--wa-out:color-mix(in srgb,var(--ok) 26%,var(--paper));--wa-shadow:0 1px .5px rgba(0,0,0,.3)}
.gg-mail-thread .gg-chat-list{overflow:visible;gap:2px;padding:10px 24px 22px;background-color:var(--wa-bg);
  background-image:radial-gradient(var(--wa-dot) 1.2px,transparent 1.3px),radial-gradient(var(--wa-dot) 1.2px,transparent 1.3px);
  background-size:26px 26px;background-position:0 0,13px 13px}
.gg-mail-thread .gg-chat-day{margin:10px 0 8px;padding:5px 12px;border:0;border-radius:7.5px;background:var(--wa-day);color:var(--wa-meta);
  font-size:12.5px;box-shadow:var(--wa-shadow)}
.gg-mail-thread .gg-chat-msg{position:relative;max-width:65%;margin-top:10px;padding:6px 8px 7px 9px;border:0;border-radius:7.5px;
  background:var(--wa-in);color:var(--wa-ink);font-size:14.2px;line-height:19px;box-shadow:var(--wa-shadow);cursor:pointer}
.gg-mail-thread .gg-chat-msg:not(.is-mine){border-top-left-radius:0}
.gg-mail-thread .gg-chat-msg.is-mine{background:var(--wa-out);border-top-right-radius:0}
.gg-mail-thread .gg-chat-msg::before{content:"";position:absolute;top:0;left:-8px;width:8px;height:13px;background:inherit;
  clip-path:polygon(0 0,100% 0,100% 100%)}
.gg-mail-thread .gg-chat-msg.is-mine::before{left:auto;right:-8px;clip-path:polygon(0 0,100% 0,0 100%)}
.gg-mail-thread .gg-chat-msg::after{content:attr(data-meta);display:inline-block;visibility:hidden;margin-left:12px;font-size:11px;line-height:1;white-space:nowrap}
.gg-mail-thread .gg-chat-msg .gg-chat-meta{position:absolute;right:8px;bottom:5px;margin:0;font-size:11px;line-height:15px;color:var(--wa-meta)}
/* each email is one turn, as WhatsApp draws a chat (Sam, 28 Nov 2026, with a WhatsApp chat as the model): ours hug the
   right, theirs the left, each bubble only as wide as its words, up to about four fifths of the column. Inside the bubble,
   small at the top, the address it came from (Sam, 25 Nov 2026: "my icon/logo, then the email address, and day and date");
   small at the bottom right, the day and time. The sender's circle (their identity tile, or an initial) starts each run of
   emails from one side; the next from the same side runs on close under it, no circle, no tail; a change of side leaves
   more room. */
/* the sender's circle sits above the bubble, on its own side, so the bubble has the whole width (Sam, 28 Nov 2026) */
.gg-mail-turn{display:flex;flex-direction:column;align-items:flex-start;gap:3px;margin-top:12px}
.gg-mail-turn.is-mine{align-items:flex-end}
.gg-mail-turn.is-cont{margin-top:3px}
.gg-mail-turn > .av{flex:none;width:26px;height:26px;margin:0 2px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:var(--c,var(--idle));color:#fff;font:600 13px/1 var(--ui)}
.gg-mail-turn.is-cont > .av{display:none}
.gg-mail-turn > .in{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:min(80%,680px)}
.gg-mail-turn.is-mine > .in{align-items:flex-end}
.gg-mail-turn > .av.is-tile{background:none;overflow:hidden}
.gg-mail-turn > .av.is-tile svg{display:block;width:100%;height:100%}
.gg-mail-thread .gg-mail-turn .gg-chat-msg{max-width:100%;min-width:120px;margin-top:0;padding:5px 9px 6px 10px}
.gg-mail-thread .gg-mail-turn .gg-chat-msg::after{content:none}
.gg-mail-thread .gg-mail-turn.is-cont .gg-chat-msg{border-radius:7.5px}
.gg-mail-thread .gg-mail-turn.is-cont .gg-chat-msg::before{display:none}
.gg-mail-turn .who{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px;margin:0 0 2px;font-size:12.5px;line-height:16px;color:var(--wa-meta)}
.gg-mail-turn .who b{font-weight:600;color:var(--wa-who)}
.gg-mail-turn:not(.is-mine) .who b{color:var(--primary)}
.gg-mail-turn .who .addr{overflow-wrap:anywhere}
.gg-mail-thread .gg-mail-turn .gg-chat-meta{position:static;display:block;margin:2px 0 -2px 16px;text-align:right;font-size:11px;line-height:15px;
  color:var(--wa-meta);white-space:nowrap}
.gg-mail-thread .gg-chat-who{font-size:12.8px;font-weight:600;color:var(--primary);margin-bottom:1px}
/* an email's links, pictures and folded signature inside its bubble (Sam, 16 Nov 2026: links "properly (if safe)",
   images "like google (if safe)", long signatures gone). A link shows its real address on hover; one whose words name another
   site wears the small warning mark. A picture fills the bubble's width and opens full size; the pictures sent with it sit in a
   row under the words. The "..." holds the signature and the earlier emails, in the time's grey. */
.gg-mail-thread .gg-chat-msg a{color:var(--wa-link);text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}
.gg-mail-thread .gg-chat-msg a.gg-mail-piclink{display:block;text-decoration:none}
.gg-mail-warn{display:inline-block;margin-left:3px;padding:0 5px;border-radius:3px;background:var(--warn);color:#1d2939;
  font:700 10.5px/15px var(--ui);vertical-align:1px;cursor:help}
.gg-mail-nolink{text-decoration:underline dotted;cursor:help}
.gg-mail-img{display:block;max-width:100%;height:auto;max-height:420px;margin:4px 0;border-radius:6px;object-fit:contain}
.gg-mail-pics{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;white-space:normal}
.gg-mail-pics .gg-mail-piclink{flex:0 1 180px}
.gg-mail-pics .gg-mail-img{width:100%;height:120px;max-height:none;margin:0;object-fit:cover}
.gg-mail-more{display:inline-block;margin:2px 4px 0 5px;padding:0 7px;border:0;border-radius:9px;vertical-align:middle;
  background:color-mix(in srgb,var(--wa-ink) 10%,transparent);color:var(--wa-meta);font:700 12px/16px var(--ui);letter-spacing:1px;cursor:pointer}
.gg-mail-more:hover,.gg-mail-more[aria-expanded="true"]{background:color-mix(in srgb,var(--wa-ink) 18%,transparent)}
.gg-mail-folded{display:block;margin-top:4px;font-size:13px;line-height:18px;color:var(--wa-meta)}
.gg-mail-folded[hidden]{display:none}
/* the next bubble from the same side runs on: closer, no tail, all four corners round */
.gg-mail-thread .gg-chat-msg:not(.is-mine) + [data-mail-original] + .gg-chat-msg:not(.is-mine),
.gg-mail-thread .gg-chat-msg.is-mine + [data-mail-original] + .gg-chat-msg.is-mine{margin-top:2px;border-radius:7.5px}
.gg-mail-thread .gg-chat-msg:not(.is-mine) + [data-mail-original] + .gg-chat-msg:not(.is-mine)::before,
.gg-mail-thread .gg-chat-msg.is-mine + [data-mail-original] + .gg-chat-msg.is-mine::before{display:none}
.gg-mail-thread [data-mail-original]{margin:6px 0;background:var(--paper);border:1px solid var(--hair)}

/* a phone: the rail is a drawer, rows are two lines, Compose floats */
.gg-mail-menu{display:none}
@media(max-width:760px){
  .gg-mail{grid-template-columns:minmax(0,1fr);gap:0}
  .gg-mail-rail{position:fixed;top:0;left:0;bottom:0;z-index:1000;width:min(300px,84vw);padding:16px 8px;overflow-y:auto;
    background:var(--paper);box-shadow:0 0 24px rgba(0,0,0,.3);transform:translateX(-105%);transition:transform .2s}
  .gg-mail.is-rail-open .gg-mail-rail{transform:none}
  .gg-mail-menu{display:inline-flex}
  .gg-mail-compose{position:fixed;right:16px;bottom:84px;z-index:50;margin:0;box-shadow:0 4px 14px rgba(0,0,0,.28)}
  .gg-mail-find{margin:0 0 8px}
  .gg-mail-row{padding:10px 14px;gap:3px 12px}
  .gg-mail-row > .what{flex-wrap:wrap;row-gap:2px}
  .gg-mail-row .what .s{max-width:100%}
  .gg-mail-row .what .p{flex-basis:100%}
  .gg-mail-row .what .p::before{content:none}
  .gg-mail-bar{padding:0 10px;gap:4px}
  .gg-mail-find{height:48px;padding:0 14px}
  .gg-mail-rail.gg-glass{background:var(--paper)}
  .gg-mail-thread{border-left:0;border-right:0}
  .gg-mail-thread h1{padding:14px 16px 10px;font-size:18px}
  .gg-mail-thread > .bar{padding:6px 9px}
  .gg-mail-turn > .av{width:24px;height:24px;font-size:11px}
  .gg-mail-turn > .in{max-width:88%}
  .gg-mail-msg{padding:14px 16px}
  .gg-mail-acts{padding:12px 16px 20px}
  .gg-mail-thread .gg-chat-list{padding:8px 16px 16px}
  .gg-mail-thread .gg-chat-msg{max-width:85%}
}
