:root { --bg: #f6f7f8; --card: #fff; --ink: #1f2328; --muted: #5f6b76; --line: #e3e6ea; --accent: #0f766e; --accent-soft: #e6f4f2; --danger: #b42318; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --bg: #16191d; --card: #1f2328; --ink: #e8eaed; --muted: #9aa4ae; --line: #2f353c; --accent: #2dd4bf; --accent-soft: #123b37; --danger: #f97066; } }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
.grow { flex: 1; }
.btn, button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 6px 14px; cursor: pointer; display: inline-block; }
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
input[type=text], input[type=password], input[type=search] { font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }

/* sign-in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.card .logo { width: 56px; height: 56px; border-radius: 12px; }
.card h1 { margin: 4px 0 0; font-size: 22px; }
.card label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.card details { margin-top: 6px; }
.card details summary { cursor: pointer; color: var(--accent); }
.card details ol { padding-left: 20px; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.card button[type=submit] { margin-top: 10px; background: var(--accent); color: #fff; border: 0; padding: 10px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .card button[type=submit] { color: #062b27; } }

/* signed in: Outlook-style panes (sidebar | list | reading pane) */
body:has(.layout) { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.navtoggle { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex: none; z-index: 30; }
.bar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.bar .brand img { width: 28px; height: 28px; border-radius: 7px; }
.bar .ro { font-size: 12px; font-weight: 600; background: #fef3c7; color: #92400e; border-radius: 10px; padding: 2px 10px; }
.bar form { margin: 0; }
.hamb { display: none; font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; cursor: pointer; user-select: none; }
.hamb:hover { background: var(--accent-soft); }
.scrim { display: none; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.page { max-width: 1000px; margin: 0 auto; padding: 18px; }
.head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.head h1 { font-size: 20px; margin: 0 0 6px; }
.search { display: flex; gap: 8px; margin: 4px 0 12px; }
.search input { flex: 1; min-width: 0; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.layout.reading { grid-template-columns: 250px minmax(300px, 400px) minmax(0, 1fr); }
.side { border-right: 1px solid var(--line); padding: 12px 8px; background: var(--card); overflow-y: auto; min-height: 0; }
.side .back { display: block; margin: 2px 8px 10px; }
.sidehead { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0 8px 10px; }
.folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.folders a { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; color: var(--ink); }
.folders a:hover { background: var(--bg); text-decoration: none; }
.folders a.on { background: var(--accent-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.folders b { color: var(--accent); font-size: 13px; }

.content { overflow-y: auto; padding: 16px 20px; min-width: 0; }
.domain h2 { font-size: 15px; margin: 16px 0 6px; }
.boxes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.boxes a { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--ink); }
.boxes a:hover { border-color: var(--accent); text-decoration: none; }
.av { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.av.big { width: 40px; height: 40px; font-size: 16px; }

.listcol { border-right: 1px solid var(--line); overflow-y: auto; min-width: 0; display: flex; flex-direction: column; }
.listhead { padding: 12px 14px 0; position: sticky; top: 0; background: var(--bg); z-index: 2; border-bottom: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.list a { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list a:hover { background: var(--card); text-decoration: none; }
.list li.on a { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list li.unread a { box-shadow: inset 3px 0 0 var(--accent); }
.list li.unread .lfrom, .list li.unread .lsubj { font-weight: 700; color: var(--ink); }
.lmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lrow { display: flex; gap: 8px; align-items: baseline; }
.lfrom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsubj { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { padding: 14px; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 14px 0; }

.reader { overflow-y: auto; min-width: 0; padding: 12px 20px 20px; }
.readerbar { margin-bottom: 8px; }
.narrow-only { display: none; }
.msg h1 { font-size: 21px; margin: 4px 0 12px; }
.meta { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.metatext { min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.atts { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.atts a { display: inline-block; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 10px; color: var(--ink); }
.frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* medium (tablet, Fold inner screen in portrait): sidebar + one pane; the open message replaces the list */
@media (max-width: 1100px) {
  .layout.reading { grid-template-columns: 230px minmax(0, 1fr); }
  .layout.reading .listcol { display: none; }
  .narrow-only { display: inline; }
  .wide-only { display: none; }
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
}
/* phone: the sidebar slides in from the ☰ button */
@media (max-width: 640px) {
  .layout, .layout.reading { grid-template-columns: minmax(0, 1fr); }
  .hamb { display: inline-block; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: 280px; max-width: 85vw; z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 24px rgba(0,0,0,.35); padding-top: 16px; }
  .navtoggle:checked ~ .layout .side { transform: none; }
  .navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .bar .who, .bar .brand span { display: none; }
  .listhead { padding: 10px 12px 0; }
  .reader { padding: 10px 12px 16px; }
  .frame { height: 65vh; }
}

/* ---------- app feel: behave like an installed app, not a web page ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overscroll-behavior: none; }          /* no pull-to-refresh or edge glow */
a, button, label, summary, [role="button"], img { -webkit-touch-callout: none; touch-action: manipulation; }
button, label, nav, header, summary, .btn, [role="button"], [role="tab"], [role="menuitem"] { -webkit-user-select: none; user-select: none; }
:focus:not(:focus-visible) { outline: none; }
@view-transition { navigation: auto; }             /* smooth page changes instead of a white flash */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }
.side, .list, .listhead .head, .boxes, .readerbar { -webkit-user-select: none; user-select: none; }
html { background: var(--bg); }
@media (display-mode: standalone) { .bar { padding-top: max(8px, env(safe-area-inset-top)); } }
