/* Patra · Sachin's mail app */
@font-face { font-family: 'Garamond'; src: url(fonts/eb-garamond-latin-wght-normal.woff2) format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Garamond'; src: url(fonts/eb-garamond-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 400 800; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Garamond'; src: url(fonts/eb-garamond-latin-wght-italic.woff2) format('woff2'); font-weight: 400 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument'; src: url(fonts/instrument-sans-latin-wght-normal.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Instrument'; src: url(fonts/instrument-sans-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 400 700; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Instrument'; src: url(fonts/instrument-sans-latin-wght-italic.woff2) format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --paper: #f3ede1; --sheet: #fffcf6; --sheet-2: #faf5eb; --ink: #1c1a16; --ink-2: #5d564b; --ink-3: #8d8576;
  --line: #e6dccb; --line-2: #efe7d8; --accent: #7d2a22; --accent-ink: #fbf6ee; --accent-soft: #f3e3dc; --accent-2: #a2453a;
  --gold: #b48a3c; --gold-soft: #f4e9cf; --sel: #efe5d2; --hover: #f6efe2; --focus: #c9a76a;
  --star: #c8962e; --ok: #3f6b4a; --warn: #a05a1c;
  --shadow: 0 1px 2px rgba(40,30,15,.06), 0 6px 22px rgba(40,30,15,.08);
  --shadow-lg: 0 10px 40px rgba(30,20,10,.18), 0 2px 6px rgba(30,20,10,.08);
  --r: 12px; --r-sm: 8px;
  --serif: 'Garamond', 'EB Garamond', Georgia, serif;
  --sans: 'Instrument', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --row-pad: 12px; --rail-w: 236px; --list-w: 420px;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --paper: #12110e; --sheet: #1a1814; --sheet-2: #201d18; --ink: #efe8da; --ink-2: #b9af9d; --ink-3: #847b6c;
  --line: #2d2922; --line-2: #26231d; --accent: #e08a74; --accent-ink: #1a1410; --accent-soft: #3a2621; --accent-2: #f0a08b;
  --gold: #d5ab5c; --gold-soft: #3a3020; --sel: #2c271f; --hover: #221f19; --focus: #8f7442; --star: #e2b14d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 22px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}
:root[data-density='compact'] { --row-pad: 7px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font: 14.5px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.i { width: 18px; height: 18px; flex: none; display: block; }
.i.sm { width: 15px; height: 15px; } .i.lg { width: 21px; height: 21px; }
[hidden] { display: none !important; }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
::selection { background: var(--gold-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- sign in ---------- */
.signin { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--gold-soft), transparent 60%), var(--paper); }
.signin-card { width: min(420px, 100%); background: var(--sheet); border: 1px solid var(--line); border-radius: 22px; padding: 38px 32px 30px; box-shadow: var(--shadow-lg); animation: rise .5s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.brand-mark { width: 52px; height: 52px; border-radius: 15px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 20px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.brand-mark svg { width: 28px; height: 28px; }
.signin h1 { font: 500 34px/1.1 var(--serif); margin: 0 0 6px; letter-spacing: -.01em; }
.signin p { margin: 0 0 22px; color: var(--ink-2); }
.signin label { display: block; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
.field-in { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--sheet-2); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field-in:focus { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent); }
.code-in { letter-spacing: .5em; text-align: center; font: 600 26px/1 ui-monospace, 'SF Mono', Menlo, monospace; padding: 14px 10px 14px calc(10px + .5em); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; transition: background .15s, transform .08s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border: 1px solid var(--line); background: var(--sheet); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: #b3261e; } :root[data-theme='dark'] .btn.danger { color: #f28b82; }
.btn.block { width: 100%; padding: 13px; font-size: 15.5px; margin-top: 16px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.signin .note { font-size: 13px; color: var(--ink-3); margin-top: 16px; text-align: center; }
.signin .err { color: #b3261e; font-size: 13.5px; margin-top: 10px; min-height: 1em; }
.linkish { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- shell ---------- */
.shell { position: fixed; inset: 0; display: grid; grid-template-columns: var(--rail-w) var(--list-w) 1fr; }
.rail { display: flex; flex-direction: column; padding: 14px 10px 10px; min-height: 0; background: var(--paper); }
.listpane { display: flex; flex-direction: column; min-height: 0; background: var(--sheet); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.readpane { min-height: 0; overflow: auto; background: var(--sheet); position: relative; }

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 16px; }
.brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; margin: 0; } .brand .brand-mark svg { width: 20px; height: 20px; }
.brand-name { font: 500 25px/1 var(--serif); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.compose-btn { display: flex; align-items: center; gap: 12px; padding: 14px 20px; margin: 0 4px 14px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 15px; box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 30%, transparent); transition: transform .12s, box-shadow .15s, background .15s; }
.compose-btn:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.nav { overflow: auto; flex: 1; min-height: 0; padding-bottom: 8px; scrollbar-width: thin; }
.nav a { display: flex; align-items: center; gap: 13px; padding: 8px 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; transition: background .12s; position: relative; }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav a .n { margin-left: auto; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.nav a.on .n { color: var(--accent); }
.nav .sect { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 18px 14px 6px; }
.nav .sect button { color: var(--ink-3); padding: 3px; border-radius: 6px; } .nav .sect button:hover { color: var(--ink); background: var(--hover); }
.label-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; margin: 0 4px; }
.rail-foot { border-top: 1px solid var(--line); padding: 10px 6px 2px; display: flex; align-items: center; gap: 6px; }
.syncline { font-size: 12px; color: var(--ink-3); flex: 1; min-width: 0; line-height: 1.3; padding-left: 6px; }
.syncline b { color: var(--ink-2); font-weight: 600; }
.iconbtn { width: 36px; height: 36px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--ink-2); transition: background .12s, color .12s; flex: none; position: relative; }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.iconbtn.on { color: var(--accent); }
.iconbtn[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 50; animation: fade .15s .35s both; }
@keyframes fade { from { opacity: 0; } }

/* ---------- list ---------- */
.listhead { padding: 12px 12px 8px; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid transparent; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--sheet-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 14px; height: 42px; transition: border-color .15s, box-shadow .15s, background .15s; }
.search:focus-within { border-color: var(--focus); background: var(--sheet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.search input { flex: 1; border: 0; background: none; outline: none; min-width: 0; font-size: 15px; }
.search .i { color: var(--ink-3); }
.menu-toggle { display: none; }
.viewhead { display: flex; align-items: baseline; gap: 10px; padding: 6px 18px 8px; }
.viewhead h2 { font: 500 24px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; }
.viewhead .sub { color: var(--ink-3); font-size: 12.5px; }
.viewhead .grow { flex: 1; }
.tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
.tab { text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 550; color: var(--ink-2); display: flex; gap: 7px; align-items: center; transition: background .12s; }
.tab:hover { background: var(--hover); } .tab.on { background: var(--ink); color: var(--paper); }
.tab .n { font-size: 11.5px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; line-height: 17px; font-weight: 700; }
.bulkbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; margin: 0 8px 6px; border-radius: 12px; background: var(--gold-soft); animation: drop .18s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.bulkbar .count { font-weight: 650; padding: 0 8px; flex: 1; }
.list { flex: 1; overflow: auto; overscroll-behavior: contain; min-height: 0; list-style: none; margin: 0; padding: 0 0 90px; scrollbar-width: thin; }
.row { position: relative; display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; padding: var(--row-pad) 14px var(--row-pad) 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); transition: background .1s; user-select: none; -webkit-user-select: none; touch-action: pan-y; background: var(--sheet); }
.row:hover { background: var(--hover); }
.row.open { background: var(--sel); }
.row.sel { background: var(--gold-soft); }
.row.focus::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.row.unread .who, .row.unread .subj { font-weight: 700; color: var(--ink); }
.row.unread::after { content: ''; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 15px; letter-spacing: .01em; position: relative; flex: none; }
.av .ck { position: absolute; inset: 0; border-radius: 50%; display: none; place-items: center; background: var(--ink); color: var(--paper); }
.row .avbox:hover .ck, .list.selecting .ck { display: grid; }
.list.selecting .av .ck { background: var(--sheet); color: var(--ink-3); border: 2px solid var(--line); }
.row.sel .av .ck { display: grid; background: var(--accent) !important; color: var(--accent-ink) !important; border: 0 !important; }
.row-main { min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 550; }
.who .cnt { color: var(--ink-3); font-weight: 500; font-size: 12.5px; margin-left: 3px; }
.who .draftmark { color: #b3261e; font-weight: 600; }
.when { font-size: 12.5px; color: var(--ink-3); flex: none; font-variant-numeric: tabular-nums; }
.row.unread .when { color: var(--accent); font-weight: 650; }
.subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); margin-top: 1px; font-weight: 500; }
.snip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font-size: 13.5px; margin-top: 1px; }
:root[data-density='compact'] .snip { display: none; }
.meta { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.meta:empty { display: none; }
.chip { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-weight: 550; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.chip.snz { background: var(--gold-soft); color: var(--warn); }
.chip.clip { background: transparent; border: 1px solid var(--line); padding: 1px 5px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.star { color: var(--ink-3); padding: 4px; margin: -4px -4px 0 0; border-radius: 8px; }
.star:hover { color: var(--star); background: var(--hover); }
.star.on { color: var(--star); } .star.on svg { fill: currentColor; }
.row-actions { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: var(--hover); padding-left: 10px; box-shadow: -14px 0 14px -4px var(--hover); }
.row:hover .row-actions { display: flex; }
.row.sel .row-actions { background: var(--gold-soft); box-shadow: -14px 0 14px -4px var(--gold-soft); }
.row.open .row-actions { background: var(--sel); box-shadow: -14px 0 14px -4px var(--sel); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 26px; color: #fff; font-weight: 650; gap: 10px; z-index: 0; }
.swipe-bg.right { background: var(--ok); } .swipe-bg.left { background: var(--gold); justify-content: flex-end; }
.row.swiping { transition: none; z-index: 1; }
.list-end { text-align: center; color: var(--ink-3); padding: 22px; font-size: 13px; }
.empty { display: grid; place-items: center; text-align: center; padding: 60px 30px; color: var(--ink-3); }
.empty .art { width: 74px; height: 74px; border-radius: 22px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .art svg { width: 34px; height: 34px; }
.empty h3 { font: 500 23px/1.2 var(--serif); color: var(--ink); margin: 0 0 6px; }
.skel { height: 74px; margin: 0; border-bottom: 1px solid var(--line-2); background: linear-gradient(90deg, transparent, var(--hover), transparent) no-repeat; background-size: 50% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: -100% 0; } to { background-position: 200% 0; } }
.searchnote { margin: 0 12px 8px; padding: 9px 14px; border-radius: 12px; background: var(--sheet-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.searchnote button { color: var(--accent); font-weight: 650; }

/* ---------- reading ---------- */
.readempty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 40px; }
.readempty .big { font: italic 400 30px/1.25 var(--serif); color: var(--ink-2); margin-bottom: 10px; }
.readempty .keys { font-size: 12.5px; }
kbd { font: 600 11.5px/1 ui-monospace, Menlo, monospace; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--sheet-2); border-bottom-width: 2px; color: var(--ink-2); }
.tbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 8px 14px; background: color-mix(in srgb, var(--sheet) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.tbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.tbar .grow { flex: 1; }
.tbar .pos { font-size: 12.5px; color: var(--ink-3); margin-right: 4px; font-variant-numeric: tabular-nums; }
.back { display: none; }
.thread { max-width: 900px; margin: 0 auto; padding: 22px 28px 120px; }
.thread h1 { font: 500 30px/1.2 var(--serif); margin: 4px 0 10px; letter-spacing: -.012em; word-break: break-word; }
.thread .tlabels { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.thread .tlabels .chip { cursor: pointer; } .thread .tlabels .chip:hover { background: var(--accent-soft); color: var(--accent); }
.msg { border: 1px solid var(--line); border-radius: var(--r); background: var(--sheet); margin-bottom: 10px; box-shadow: 0 1px 0 rgba(0,0,0,.02); transition: box-shadow .15s; overflow: hidden; }
.msg.open { box-shadow: var(--shadow); }
.msg-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px 10px; cursor: pointer; }
.msg:not(.open) .msg-head { padding-bottom: 14px; align-items: center; }
.msg-head .who2 { flex: 1; min-width: 0; }
.msg-head .nm { font-weight: 650; } .msg-head .ad { color: var(--ink-3); font-size: 13px; margin-left: 4px; }
.msg-head .tos { color: var(--ink-3); font-size: 13px; margin-top: 1px; display: flex; align-items: center; gap: 2px; }
.msg-head .tos button { color: var(--ink-3); display: inline-flex; padding: 2px; border-radius: 4px; } .msg-head .tos button:hover { background: var(--hover); }
.msg-head .pv { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.msg-head .dt-m { display: none; }
.msg-head .dt { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.msg-head .acts { display: flex; gap: 0; margin: -6px -8px 0 0; }
.msg:not(.open) .msg-head .acts { display: none; }
.hdrtable { margin: 0 16px 10px 66px; padding: 10px 14px; background: var(--sheet-2); border-radius: 10px; font-size: 13px; display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; color: var(--ink-2); }
.hdrtable dt { color: var(--ink-3); text-align: right; } .hdrtable dd { margin: 0; word-break: break-word; }
.msg-body { padding: 0 16px 6px 66px; }
.msg-body iframe { width: 100%; border: 0; display: block; background: #fff; border-radius: 6px; min-height: 40px; }
:root[data-theme='dark'] .msg-body iframe { border-radius: 8px; }
.textbody { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.6; }
.textbody .q { color: var(--ink-3); }
.trimbtn { margin: 6px 0 4px; padding: 0 9px; height: 20px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); display: inline-flex; align-items: center; font-weight: 800; letter-spacing: .1em; }
.trimbtn:hover { background: var(--line); }
.atts { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 16px 16px 66px; }
.att { width: 190px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; background: var(--sheet-2); text-align: left; transition: border-color .12s, background .12s; }
.att:hover { border-color: var(--focus); background: var(--sheet); }
.att .ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.att .nm { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { font-size: 12px; color: var(--ink-3); }
.att > div:nth-child(2) { min-width: 0; flex: 1; }
.earlier { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; color: var(--ink-2); font-weight: 600; font-size: 13px; width: 100%; }
.earlier::before, .earlier::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.earlier span { padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--sheet); }
.earlier:hover span { background: var(--hover); }
.replybar { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.replybar .btn { padding: 10px 20px; }
.loading-thread { padding: 60px; text-align: center; color: var(--ink-3); }

/* ---------- composer ---------- */
.composer { position: fixed; right: 24px; bottom: 0; width: 600px; max-width: calc(100vw - 24px); height: min(640px, calc(100vh - 60px)); background: var(--sheet); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); z-index: 40; display: flex; flex-direction: column; animation: up .22s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.composer.min { height: 48px !important; overflow: hidden; }
.composer.min .c-body { display: none; }
.composer.full { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, calc(100vw - 80px)); height: calc(100vh - 80px); border-radius: 18px; border-bottom: 1px solid var(--line); animation: none; }
.composer-scrim { position: fixed; inset: 0; background: rgba(20,14,8,.35); z-index: 39; animation: fade .2s; }
.c-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 18px; height: 48px; flex: none; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.c-head .ttl { flex: 1; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head .st { font-size: 12px; color: var(--ink-3); margin-right: 6px; }
.c-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.c-field { display: flex; align-items: flex-start; gap: 8px; padding: 4px 14px 4px 18px; border-bottom: 1px solid var(--line-2); min-height: 44px; position: relative; }
.c-field > label { color: var(--ink-3); width: 34px; padding-top: 10px; font-size: 14px; flex: none; }
.chips { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 5px 0; min-width: 0; }
.chips input { flex: 1; min-width: 120px; border: 0; outline: none; background: none; padding: 5px 2px; font-size: 15px; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--line-2); font-size: 13.5px; max-width: 100%; }
.rchip.bad { background: #fbe0dc; color: #8c1d18; }
.rchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rchip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); } .rchip button:hover { background: var(--line); color: var(--ink); }
.c-field .ccb { color: var(--ink-3); font-size: 13.5px; padding: 10px 4px 0; } .c-field .ccb:hover { color: var(--ink); }
.c-subject { border: 0; outline: none; background: none; width: 100%; font-size: 15.5px; font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.suggest { position: absolute; left: 56px; top: calc(100% - 4px); z-index: 5; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 300px; max-width: calc(100% - 70px); padding: 6px; }
.suggest button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 10px; border-radius: 8px; text-align: left; }
.suggest button.on, .suggest button:hover { background: var(--hover); }
.suggest .av { width: 30px; height: 30px; font-size: 12.5px; }
.suggest .t { min-width: 0; } .suggest .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .suggest .t .a { font-size: 12.5px; color: var(--ink-3); }
.c-scroll { flex: 1; overflow: auto; min-height: 0; padding: 0 18px; }
.editor { outline: none; min-height: 160px; padding: 14px 0 10px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.editor:empty::before { content: attr(data-ph); color: var(--ink-3); pointer-events: none; }
.editor blockquote, .quoted blockquote { margin: 0 0 0 .8ex; border-left: 2px solid var(--line); padding-left: 1ex; color: var(--ink-2); }
.editor img { max-width: 100%; }
.sig { color: var(--ink-2); }
.quoted { border-top: 0; padding: 4px 0 18px; color: var(--ink-2); font-size: 14px; }
.quoted .qtoggle { margin: 0; }
.c-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 14px; }
.c-att { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet-2); font-size: 13px; max-width: 260px; }
.c-att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } .c-att .sz { color: var(--ink-3); flex: none; }
.c-att.up { opacity: .6; }
.c-tools { display: flex; gap: 0; padding: 4px 10px; border-top: 1px solid var(--line-2); flex-wrap: wrap; flex: none; }
.c-tools .iconbtn { width: 34px; height: 34px; border-radius: 8px; }
.c-foot { display: flex; align-items: center; gap: 4px; padding: 10px 12px 12px 14px; flex: none; }
.sendgrp { display: inline-flex; border-radius: 999px; overflow: hidden; background: var(--accent); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.sendgrp button { color: var(--accent-ink); padding: 10px 20px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.sendgrp button:hover { background: var(--accent-2); }
.sendgrp .more { padding: 10px 12px; border-left: 1px solid color-mix(in srgb, var(--accent-ink) 25%, transparent); }
.c-foot .grow { flex: 1; }
.dropzone { position: absolute; inset: 48px 0 0; background: color-mix(in srgb, var(--accent-soft) 90%, transparent); border: 2px dashed var(--accent); border-radius: 0 0 0 0; display: grid; place-items: center; font: 500 22px var(--serif); color: var(--accent); z-index: 4; pointer-events: none; }

/* ---------- menus, modals, toasts ---------- */
.pop { position: fixed; z-index: 70; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; max-height: 70vh; overflow: auto; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop .mi { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 9px; text-align: left; white-space: nowrap; }
.pop .mi:hover, .pop .mi.on { background: var(--hover); }
.pop .mi .r { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }
.pop .mh { padding: 8px 12px 4px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 4px; }
.pop .box { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--ink-3); display: grid; place-items: center; flex: none; }
.pop .box.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pop input[type=datetime-local], .pop input[type=text] { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--sheet-2); margin: 4px 0 6px; }
.scrim { position: fixed; inset: 0; z-index: 60; }
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(20,14,8,.4); animation: fade .18s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--sheet); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 26px 28px 22px; animation: rise .25s cubic-bezier(.2,.8,.2,1); }
.modal h2 { font: 500 27px/1.2 var(--serif); margin: 0 0 18px; display: flex; align-items: center; }
.modal h2 .grow { flex: 1; }
.modal .row2 { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line-2); }
.modal .row2 > label { font-weight: 600; padding-top: 8px; }
.modal .row2 .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { padding: 6px 14px; border-radius: 999px; font-weight: 550; color: var(--ink-2); font-size: 13.5px; }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.sigedit { min-height: 90px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet-2); outline: none; }
.sigedit:focus { border-color: var(--focus); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; font-size: 14px; }
.keys-grid div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); }
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 90; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); padding: 12px 12px 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: min(460px, calc(100vw - 32px)); animation: rise .22s cubic-bezier(.2,.8,.2,1); font-weight: 500; }
.toast .msgt { flex: 1; }
.toast button { color: var(--gold); font-weight: 700; padding: 4px 8px; border-radius: 6px; } .toast button:hover { background: rgba(255,255,255,.08); }
:root[data-theme='dark'] .toast button { color: #8a5a10; }
.toast.err { background: #8c1d18; color: #fff; } .toast.err button { color: #fff; }
.toast .x { color: inherit; opacity: .7; padding: 4px; }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(10,8,6,.88); display: grid; grid-template-rows: auto 1fr; animation: fade .18s; }
.lightbox header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; }
.lightbox header .t { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox header .iconbtn { color: #fff; } .lightbox header .iconbtn:hover { background: rgba(255,255,255,.12); }
.lightbox .stage { display: grid; place-items: center; min-height: 0; padding: 0 20px 20px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 8px; }
.fab { display: none; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; overflow: hidden; pointer-events: none; }
.progress::after { content: ''; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent); animation: prog 1.1s ease-in-out infinite; }
@keyframes prog { from { left: -30%; } to { left: 100%; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { :root { --rail-w: 216px; --list-w: 370px; } }
@media (max-width: 1250px) { .msg-head .ad { display: none; } }
@media (max-width: 1100px) {
  :root { --rail-w: 76px; }
  .rail { padding: 12px 8px; align-items: center; }
  .brand { padding: 4px 0 14px; } .brand-name, .brand-sub, .nav a span, .nav a .n, .nav .sect, .syncline, .compose-btn span { display: none; }
  .compose-btn { padding: 14px; margin: 0 0 12px; border-radius: 16px; }
  .nav a { padding: 10px; justify-content: center; border-radius: 14px; }
  .nav a .badge { position: absolute; top: 4px; right: 4px; min-width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
  .rail-foot { flex-direction: column; border: 0; }
}
@media (min-width: 1101px) { .nav a .badge { display: none; } }
@media (max-width: 860px) {
  :root { --list-w: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 280px; align-items: stretch; background: var(--paper); transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-lg); padding: calc(14px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom)); }
  .rail .nav a span, .rail .nav a .n, .rail .syncline { display: initial; } .rail .brand-name, .rail .brand-sub { display: block; }
  .shell.drawer ~ .fab { display: none; }
  .rail .nav .sect { display: flex; } .rail .nav a { justify-content: flex-start; padding: 10px 14px; border-radius: 999px; } .rail .nav a .badge { display: none; }
  .rail .compose-btn { display: none; } .rail .rail-foot { flex-direction: row; border-top: 1px solid var(--line); }
  .shell.drawer .rail { transform: none; }
  .drawer-scrim { position: fixed; inset: 0; z-index: 49; background: rgba(20,14,8,.35); animation: fade .2s; }
  .listpane { border: 0; padding-top: env(safe-area-inset-top); }
  .menu-toggle { display: inline-grid; }
  .readpane { position: fixed; inset: 0; z-index: 30; transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); padding-top: env(safe-area-inset-top); }
  .shell.reading .readpane { transform: none; }
  .back { display: inline-grid; }
  .thread { padding: 14px 14px 140px; }
  .thread h1 { font-size: 25px; }
  .msg-head { padding: 12px 12px 8px; gap: 10px; }
  .msg-body { padding: 0 12px 6px; } .atts { padding: 6px 12px 14px; } .hdrtable { margin: 0 12px 10px; }
  .att { width: calc(50% - 5px); }
  .msg.open .msg-head > .dt, .msg-head .ad { display: none; }
  .msg.open .msg-head .dt-m { display: inline; }
  .msg-head .tos { flex-wrap: wrap; }
  .shell.reading ~ .fab { display: none; }
  .row-actions { display: none !important; }
  .fab { display: flex; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; align-items: center; gap: 10px; padding: 16px 22px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); font-weight: 650; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
  .composer, .composer.full { inset: 0; width: 100%; max-width: none; height: 100% !important; border-radius: 0; transform: none; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .composer .c-head .hide-m { display: none; }
  .toasts { left: 12px; right: 12px; bottom: calc(90px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .modal .row2 { grid-template-columns: 1fr; gap: 6px; } .modal .row2 > label { padding-top: 0; }
  .keys-grid { grid-template-columns: 1fr; }
  .tbar { padding: 6px 6px; }
  .tbar .hide-m { display: none; }
}
@media print {
  .rail, .listpane, .tbar, .replybar, .composer, .toasts, .fab { display: none !important; }
  .shell { display: block; position: static; } .readpane { position: static; overflow: visible; transform: none !important; }
  body { overflow: visible; background: #fff; } .msg { box-shadow: none; break-inside: avoid; }
}
