/* Light-only, on the quotes.ops brand tokens (logistics app index.css): Advantage action blue hsl(217 82% 42%),
   slate text and borders, 0.5rem radius, Inter where installed. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --hover: #f8fafc;
  --primary: #1357c3;
  --primary-soft: #e8effb;
  --warn: #b42318;
  --radius: 0.5rem;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; }
.warn { color: var(--warn); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 14px/1 inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--line); color: var(--text); }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: 64px; padding: 0 16px 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; width: 212px; flex: none; color: var(--primary); font-weight: 700; font-size: 16px; }
.brand svg { width: 28px; height: 28px; }
.brand span { color: var(--text); }
.search-wrap { position: relative; flex: 1; max-width: 760px; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 14px; border-radius: 10px;
  background: var(--soft); border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s; }
.search:focus-within { background: var(--surface); border-color: var(--line); box-shadow: 0 1px 6px rgba(15, 23, 42, .12); }
.search > svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.filters { position: absolute; top: 50px; left: 0; right: 0; z-index: 30; display: grid; gap: 10px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); }
.filters label { display: grid; gap: 4px; min-width: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.filters input:not([type=checkbox]) { width: 100%; min-width: 0; }
.filters input:not([type=checkbox]) { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 14px; color: var(--text); background: var(--surface); }
.filters input:focus-visible { outline: 0; border-color: var(--primary); }
.filters .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters .check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.filters .hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); line-height: 1.9; }
.filters .actions { display: flex; justify-content: flex-end; gap: 8px; }
.who { position: relative; margin-left: auto; min-width: 0; }
.who summary { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer; list-style: none; }
.who summary::-webkit-details-marker { display: none; }
.who summary:hover, .who[open] summary { background: var(--soft); }
.who .email { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); }
.who-email { color: var(--muted); font-size: 13px; margin-bottom: 10px; word-break: break-all; }
.who-menu .btn { width: 100%; justify-content: center; }
.t-short { display: none; }
.threads .avatar { display: none; }
.filters-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; margin: -6px -6px 0 0; }

/* avatars: eight fixed colours, picked per address */
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 14px; flex: none; }
.c0 { background: #1357c3; } .c1 { background: #0f7b6c; } .c2 { background: #b45309; } .c3 { background: #7c3aed; }
.c4 { background: #be123c; } .c5 { background: #0e7490; } .c6 { background: #4d7c0f; } .c7 { background: #a21caf; }

/* frame */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
.side { position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); overflow-y: auto; padding: 12px 8px 24px 0; }
.side a { display: flex; align-items: center; gap: 14px; height: 36px; padding: 0 14px 0 20px; border-radius: 0 18px 18px 0; color: var(--text); }
.side a:hover { background: var(--soft); }
.side a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side a small { margin-left: auto; color: var(--muted); font-weight: 400; }
.side h3 { margin: 18px 0 6px 20px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-note { margin: 22px 14px 0 20px; font-size: 12px; color: var(--muted); }
main#content { padding: 18px 24px 48px; min-width: 0; }
main.bare { padding: 24px 16px; }

/* lists */
.list-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 12px; }
.list-head .count { color: var(--muted); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 500; }
.threads { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.threads li + li { border-top: 1px solid var(--line); }
.threads a { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 11px 16px; }
.threads a:hover { background: var(--hover); box-shadow: inset 3px 0 0 var(--primary); }
.threads .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.threads .from small { color: var(--muted); font-weight: 400; font-size: 12px; }
.threads .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.threads .subj b { font-weight: 600; }
.threads .snip { color: var(--muted); }
.threads .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.clip svg { width: 16px; height: 16px; color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); }
.more { color: var(--muted); font-size: 13px; margin: 12px 4px; }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); }
.empty h1 { color: var(--text); margin-bottom: 6px; }
.results.loading { opacity: .55; transition: opacity .1s; }

/* thread */
.thread { max-width: 980px; }
/* the bar with Back and the subject stays under the header while a long mail scrolls */
.thread-bar { position: sticky; top: 64px; z-index: 10; display: flex; align-items: center; gap: 8px;
  margin: -18px -24px 6px; padding: 10px 24px; background: var(--bg);
  border-bottom: 1px solid var(--line); }
.thread-bar h1 { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-bar .btn { flex: none; }
.thread .sub { margin: 10px 0 14px; color: var(--muted); font-size: 13px; }
/* each mail: a tinted header strip (click to open/close) above a white body */
details.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; overflow: hidden; }
details.msg summary { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; list-style: none; background: #eef2f7; transition: background .12s; }
details.msg summary::-webkit-details-marker { display: none; }
details.msg summary:hover { background: #e3e9f2; }
details[open].msg summary { background: #e8eef9; border-bottom: 1px solid #d5deec; }
details[open].msg summary:hover { background: #dde6f6; }
details.msg summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.msg .chev { width: 20px; height: 20px; color: var(--muted); transition: transform .15s; }
details[open].msg .chev { transform: rotate(180deg); color: var(--primary); }
.msg .sender { min-width: 0; overflow: hidden; }
.msg .addr { color: var(--muted); font-size: 13px; }
.msg .snip { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details[open].msg .snip { display: none; }
.msg .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.msg-body { padding: 12px 16px 16px 60px; }
/* Gmail's "•••": shows or hides the quoted earlier mails inside a reply */
.quote-toggle { display: inline-flex; align-items: center; height: 20px; margin: 4px 0 2px; padding: 0 9px; border: 0; border-radius: 10px;
  background: #e2e8f0; color: #334155; font: 700 13px/1 inherit; letter-spacing: 1px; cursor: pointer; }
.quote-toggle:hover { background: #cbd5e1; }
.quote-toggle[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary); }
.rcpt { color: var(--muted); font-size: 12px; }
.rcpt .addr { font-size: 12px; }
iframe.mail-body { display: block; width: 100%; height: 60px; border: 0; margin-top: 8px; background: #fff; }
.files { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0 0; margin: 8px 0 0; border-top: 1px dashed var(--line); }
.files a { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  width: 250px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.files a:hover { border-color: var(--primary); background: var(--primary-soft); }
.files .ext { grid-row: span 2; min-width: 40px; padding: 7px 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; text-align: center; }
.files .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.files small { color: var(--muted); font-size: 12px; }

/* sign-in */
.login { max-width: 420px; margin: 10vh auto; padding: 36px 32px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 24px rgba(15, 23, 42, .06); }
.login-logo svg { width: 48px; height: 48px; color: var(--primary); }
.login h1 { margin: 10px 0 8px; }
.login p { color: var(--muted); }
#gbtn { display: flex; justify-content: center; margin: 22px 0 6px; min-height: 44px; }
.dev a { color: var(--primary); }

/* narrow screens: years become a chip row, the search takes its own line */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .brand { width: auto; }
  .who { margin-left: auto; }
  .who .email { display: none; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px 0; }
  .side a { flex: none; height: 32px; padding: 0 12px; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
  .side h3, .side-note { display: none; }
  main#content { padding: 14px 12px 40px; }
  .threads a { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .threads .subj { grid-column: 1 / -1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .top { position: static; }
  .thread-bar { top: 0; margin: -14px -12px 6px; padding: 8px 12px; }
  .thread-bar .btn span { display: none; }
  .msg-body { padding: 12px 12px 14px; }
  .msg .meta time { font-size: 11px; }
  .files a { width: 100%; }
}
/* while live-search results stand in for the page, no sidebar entry is "current" */
.searching .side a.on { background: transparent; color: var(--text); font-weight: 400; }

/* phones: Gmail-mobile layout — one-row app bar, avatar list rows, the thread bar as the app bar when reading */
@media (max-width: 720px) {
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  .t-long { display: none; }
  .t-short { display: inline; }
  .top { position: sticky; top: 0; flex-wrap: nowrap; height: 60px; padding: 8px 10px; gap: 8px; }
  .brand span { display: none; }
  .brand svg { width: 26px; height: 26px; }
  .search-wrap { order: 0; flex: 1 1 auto; flex-basis: auto; position: static; }
  .search { height: 44px; border-radius: 22px; padding: 0 4px 0 12px; }
  .search input { font-size: 16px; } /* 16px or more: iOS does not zoom the page on focus */
  .who { margin-left: 0; }
  .who summary { padding: 2px; }
  .who .email { display: none; }
  .filters { position: fixed; inset: 0; z-index: 60; align-content: start; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0; border-radius: 0; box-shadow: none; overflow-x: hidden; overflow-y: auto; }
  .filters .hint code { white-space: normal; word-break: break-all; }
  .filters input:not([type=checkbox]) { height: 44px; font-size: 16px; }
  .filters .row2 { grid-template-columns: 1fr 1fr; }
  .filters .actions { position: sticky; bottom: 0; padding-top: 10px; background: var(--surface); }
  .filters .actions .btn { flex: 1; height: 44px; justify-content: center; }
  .side { padding: 10px 12px 2px; gap: 8px; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side a { height: 34px; }
  main#content { padding: 12px 0 40px; }
  .list-head, .results > .warn, .more { padding: 0 14px; }
  .threads { border-radius: 0; border-left: 0; border-right: 0; }
  .threads a { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av from meta" "av subj subj";
    gap: 2px 12px; padding: 12px 14px; align-items: start; }
  .threads a:hover { box-shadow: none; }
  .threads .avatar { display: grid; grid-area: av; width: 40px; height: 40px; font-size: 16px; }
  .threads .from { grid-area: from; font-size: 15px; }
  .threads .meta { grid-area: meta; padding-top: 2px; }
  .threads .subj { grid-area: subj; display: block; white-space: normal; }
  .threads .subj b, .threads .snip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .threads .dash { display: none; }
  .pager .btn { height: 40px; }
  .thread-page .top, .thread-page .side { display: none; }
  .thread-page main#content { padding-top: 0; }
  .thread-bar { top: 0; margin: 0 0 4px; padding: 6px 8px; background: var(--surface); }
  .thread-bar .btn { height: 40px; padding: 0 10px; }
  .thread-bar h1 { font-size: 16px; }
  .thread .sub { padding: 0 14px; font-size: 12px; }
  details.msg { margin: 8px 0; border-radius: 0; border-left: 0; border-right: 0; }
  details.msg summary { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .msg .avatar { width: 36px; height: 36px; }
  .msg .addr { display: none; }
  .msg .meta { gap: 4px; }
  .msg-body { padding: 10px 12px 14px; }
  .rcpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .rcpt.all { display: block; }
  .files a { width: 100%; }
  .quote-toggle { height: 28px; padding: 0 14px; }
  .login { margin: 6vh 16px; padding: 28px 20px; }
}
