/* Mail tab (Clear desk): title row, tiles, the cards behind them, the everything-else list with its chips and search,
   and the bill actions (shared with the reading pane strip and the bill history page). Phone first; 900 px is desktop. */

/* layout: the list column, and the reading pane beside it from 900 px (the pane itself is in pane.css) */
.inbox { margin: 0 auto; }
.inbox-layout {
  --list-w: 400px;
  display: grid;
  grid-template-columns: 100% 0px 0px;
  transition: grid-template-columns .32s cubic-bezier(.2, .8, .2, 1);
}
.inbox-layout.open { grid-template-columns: var(--list-w) 6px calc(100% - var(--list-w) - 6px); }
.inbox-layout.resizing { transition: none; user-select: none; }
.inbox-list { min-width: 0; max-width: 760px; }
.inbox-layout.open .inbox-list { max-width: none; }
.pane-divider { visibility: hidden; cursor: col-resize; position: relative; touch-action: none; }
.pane-divider::after { content: ""; position: absolute; inset: 0 2px; background: var(--line); }
.pane-divider:hover::after, .pane-divider.dragging::after { background: var(--primary); }
.inbox-layout.open .pane-divider { visibility: visible; }
@media (max-width: 899px) {
  /* The phone shows either the list or the mail, never both. */
  .inbox-layout, .inbox-layout.open { display: block; }
  .inbox-layout.open .inbox-list, .pane-divider { display: none; }
  .inbox-layout:not(.open) .pane { display: none; }
}
@media (prefers-reduced-motion: reduce) { .inbox-layout { transition: none; } }

/* title row: date, "Mail", search and (phone) Write */
.inbox-list > .page-date { margin-top: 4px; }
.mail-head { display: flex; align-items: center; gap: 4px; margin: 2px 0 14px; }
.mail-head .page-title { margin: 0; flex: 1; min-width: 0; }
.mail-head .icon-btn[aria-expanded="true"] { color: var(--primary); background: var(--primary-soft); }
.mail-write { min-height: 40px; }
@media (min-width: 900px) { .mail-write { display: none; } }

/* sync problems above the tiles */
.sync-problems { display: grid; gap: 8px; margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--warn-soft); color: var(--text); font-size: 14px; }
.sync-problems ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.sync-problems li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.sync-problems .tag { min-width: 0; padding: 1px 6px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
@media (max-width: 480px) {
  .sync-problems li { grid-template-columns: auto minmax(0, 1fr); }
  .sync-problems li .btn { grid-column: 1 / -1; justify-self: start; }
}

/* tiles: base.css draws them; here they are links */
a.tile:hover { border-color: var(--line); }
a.tile[aria-current="true"] { background: var(--primary-soft); border-color: var(--primary); }
a.tile[aria-current="true"]:hover { border-color: var(--primary); }

/* everything else: chips, search, the list */
.intent-chips { margin-bottom: 4px; }
.filter-chip .chip-n { font-size: 12px; color: inherit; opacity: .75; font-variant-numeric: tabular-nums; }
.mail-search { display: grid; gap: 8px; margin-bottom: 10px; }
.mail-search[hidden] { display: none; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--weak); color: var(--muted); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font: 16px var(--sans); color: var(--text); }
.search input::placeholder { color: var(--muted); }
/* The field inside is borderless, so the ring goes on the whole search box. */
.search:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.filter-chip.acct { gap: 8px; }
/* The search row's chips are switches, not the list's one choice: pressed is the soft accent, so they never read as a second filter row. */
.search-filters .filter-chip[aria-pressed="true"] { background: var(--primary-soft); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--primary); }
.filter-chip:disabled { cursor: not-allowed; opacity: .6; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc, var(--muted)); flex: none; }
.filter-chip.acct[aria-pressed="false"] .chip-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--acc, var(--muted)); }

.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-row {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; align-items: baseline;
  padding: 12px 10px; margin: 0 -10px;
  border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
a.mail-row:hover { background: var(--weak); color: inherit; }
.mail-row[aria-current="true"] { background: var(--primary-soft); border-radius: var(--radius); border-bottom-color: transparent; }
.row-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-who .from { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.row-who .domain { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 2 auto; }
.row-who .flag { flex: none; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.mail-row.read .unread-dot { display: none; }
.mail-row.read .from { font-weight: 500; }
.mail-row time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mail-row .line { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row .line > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.mail-row .line .ai-mark { flex: none; }
.mail-row:not(.read) .line { color: var(--text); }
.handled-list .mail-row .line { color: var(--muted); }

/* the row bin: the link's sibling, laid over the row's right edge (the row reaches 10px past the item).
   Shown on hover, on the open row and on Promotion and Junk; not a Tab stop (Del and the pane's Bin are) */
.mail-item { position: relative; }
.mail-item:hover > a.mail-row { background: var(--weak); }
.mail-item > .bin { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius); background: var(--bg); color: var(--muted); cursor: pointer; opacity: 0; }
.mail-item:hover > .bin, .mail-row[aria-current="true"] + .bin, .mail-row.disposable + .bin { opacity: 1; }
.mail-item > .bin:hover { color: var(--danger); background: var(--danger-soft); }
/* Phone: no hover, so the list stays calm. The bin shows on every row of the Noise chip only; elsewhere the open mail has it. */
@media (hover: none), (max-width: 899px) {
  .mail-list:not(.mail-list-noise) .mail-item > .bin { display: none; }
  .mail-list-noise .mail-item > .bin { opacity: 1; }
  .mail-list-noise .mail-row { padding-right: 52px; }
}

.noise-bin-all { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--muted); }
.trash-toast, .card-toast { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; }
.trash-toast .linkish, .card-toast .linkish { color: var(--primary-soft); font-weight: 600; text-decoration: none; min-height: 32px; }
.inbox-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 0; }
.inbox-empty, .cards-empty { padding: 18px 0; color: var(--muted); }

/* cards behind the need-you and bills tiles */
.ny-card { gap: 4px; }
.ny-card:has(> .card-open[aria-current="true"]) { border-color: var(--primary); background: var(--primary-soft); }
.card-open { display: grid; gap: 4px; color: inherit; text-decoration: none; border-radius: 8px; }
.card-open:hover { color: inherit; }
.card-open:hover .card-who { color: var(--primary); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.card-who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-chips { display: flex; gap: 6px; flex: none; }
.card-why { font-size: 15px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { align-items: center; }
.card-actions .btn.primary { flex: 1; }
.card-actions .btn.icon-only, .card-menu > summary { width: 40px; min-width: 40px; padding: 0; }
.card-menu { position: relative; }
.card-menu > summary { list-style: none; }
.card-menu > summary::-webkit-details-marker { display: none; }
.card-menu[open] > summary { background: var(--primary-soft); color: var(--primary); }
.card-menu .menu { position: absolute; right: 0; top: 46px; z-index: 5; min-width: 170px; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: 0 8px 24px var(--scrim); }
.card-menu .menu button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 500 15px var(--sans); text-align: left; cursor: pointer; }
.card-menu .menu button:hover { background: var(--weak); }
.quiet-group { margin-top: 14px; }
.quiet-group > summary { min-height: 40px; display: flex; align-items: center; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; }
.bill-card-acts .file-btn { position: relative; cursor: pointer; }
.ny-card .bill-band { margin-top: 6px; }

/* F8.1 bills: the bill history rows and the bill actions (cards and the reading pane strip use them) */
.bills-sub { margin: 4px 0 0; font-size: 13px; }
.bill-setup { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--primary-soft); font-size: 14px; }
.bill-setup span { flex: 1 1 260px; }
.bills { list-style: none; margin: 0; padding: 0; }
.bill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.bill-text { display: grid; gap: 2px; min-width: 0; }
.bill-who { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.bill-who b { font-weight: 600; color: var(--text); }
.bill-who .addr { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.bill-who .when { font-size: 13px; color: var(--muted); margin-left: auto; }
.bill-subject { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.bill-subject:hover { text-decoration: underline; }
.bill-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--muted); }
.file-chip { font: 500 12px var(--sans); border-radius: 99px; padding: 2px 8px; background: var(--weak); color: var(--muted); overflow-wrap: anywhere; }
.file-chip.warn { background: var(--danger-soft); color: var(--danger); }
.bill-sugg { font-size: 13px; border-radius: 99px; padding: 2px 8px; }
.bill-sugg.biz { background: var(--primary-soft); color: var(--primary); }
.bill-sugg.priv { background: var(--weak); color: var(--text); }
.bill-sugg.ign { background: var(--weak); color: var(--muted); }
.bill-sugg.none { color: var(--muted); padding-left: 0; }
.bill-problem { color: var(--danger); }
.bill-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.bill-acts .file-btn { position: relative; cursor: pointer; }
.bill-state { font: 600 12px var(--sans); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.bill-state.ok { background: var(--ok-soft); color: var(--ok); }
.bill-state.bad { background: var(--danger-soft); color: var(--danger); }
.bill-state.wait { background: var(--primary-soft); color: var(--primary); }
.bill-state.dim { background: var(--weak); color: var(--muted); }
.bill-band { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--primary-soft); font-size: 14px; }
.bill-band > span { flex: 1 1 240px; }
.bill-band b { color: var(--text); }
p.form-error.bill-band { background: var(--danger-soft); }
.bills-empty { padding: 22px 0; }
.to-line { font-size: 13px; color: var(--muted); margin-top: 14px; }
@media (max-width: 899px) {
  .bill { grid-template-columns: minmax(0, 1fr); }
  .bill-acts { justify-content: flex-start; }
  .bill-who .when { margin-left: 0; }
}
