@font-face { font-family: "Geist"; src: url(/fonts/geist.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #18191c; --bg-1: #141518; --bg-2: #1f2023; --bg-3: #26272b; --bg-4: #2e3035;
  --line: rgba(222,224,232,.09); --line-2: rgba(222,224,232,.16); --line-3: rgba(222,224,232,.26);
  --text: #f2f3f5; --soft: #b5bac1; --mute: #868a94; --ice: #dcdee3;
  --gold: #e8c179; --green: #4fd1a5; --red: #ff6b7a;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22,.8,.24,1);
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font: 400 14.5px/1.5 var(--sans); color: var(--text); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; background: var(--bg); overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(236,238,244,.35); color: #fff; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mute { color: var(--mute); }
.mono { font-family: var(--mono); font-size: 12px; }
.err { color: var(--red); min-height: 1.2em; margin: 0; font-size: 13px; }
.small-txt { font-size: 12.5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 11px 16px; font-weight: 550; font-size: 14px; letter-spacing: -.01em; border: 1px solid transparent; transition: background .2s var(--ease), transform .2s var(--ease), box-shadow .25s var(--ease); }
.btn-main { background: linear-gradient(180deg, #f4f5f7, #d9dbe0); color: #141518; box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 6px 20px -8px rgba(236,238,244,.35); }
.btn-main:hover { transform: translateY(-1px); }
.btn-main:disabled { opacity: .55; transform: none; cursor: default; }
.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--soft); border-radius: 9px; padding: 8px 12px; transition: background .2s, color .2s, border-color .2s; }
.ghost:hover { background: var(--bg-3); color: var(--text); border-color: var(--line-3); }
.ghost.small { padding: 6px 10px; font-size: 12.5px; }
.icon-btn { background: transparent; border: 0; color: var(--soft); width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn.on { color: var(--gold); }
kbd { font: 500 11px var(--mono); color: var(--mute); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 480px at 50% -120px, rgba(236,238,244,.12), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 360px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px 22px; text-align: center; box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); }
.login-logo { image-rendering: pixelated; display: block; margin: 0 auto 14px; }
.login-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 4px; }
.login-card p { margin: 0 0 20px; font-size: 13.5px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-card .err { margin-top: 12px; }
.field { display: grid; gap: 6px; text-align: left; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--soft); font-weight: 500; }
.field input, .field textarea, .row input, .from-wrap input { width: 100%; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; outline: none; transition: border-color .2s; }
.field input:focus, .field textarea:focus, .row input:focus, .from-wrap:focus-within { border-color: var(--line-3); }
.field textarea { resize: vertical; }
.field small { font-size: 12px; }

/* layout */
.app { display: grid; grid-template-columns: 236px minmax(300px, 390px) 1fr; height: 100vh; height: 100dvh; }
.side { border-right: 1px solid var(--line); background: var(--bg-1); display: flex; flex-direction: column; padding: 16px 12px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.02em; padding: 4px 8px 18px; }
.brand img { image-rendering: pixelated; }
.compose-btn { margin: 0 4px 16px; }
.folders, .boxes { display: grid; gap: 2px; }
.folders button, .boxes button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--soft); font-size: 13.5px; transition: background .15s, color .15s; }
.folders button:hover, .boxes button:hover { background: var(--bg-2); color: var(--text); }
.folders button.on, .boxes button.on { background: var(--bg-3); color: var(--text); }
.folders .ico { width: 16px; height: 16px; display: inline-grid; place-items: center; color: var(--mute); }
.folders button.on .ico { color: var(--text); }
.folders b, .boxes b { margin-left: auto; font: 500 11.5px var(--mono); color: var(--mute); }
.folders b.hot { color: var(--text); }
.boxes { overflow-y: auto; min-height: 0; }
.boxes button { font-family: var(--mono); font-size: 12px; }
.boxes button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kicker { font: 500 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); padding: 20px 10px 8px; }
.side-foot { margin-top: auto; padding: 12px 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); }

.list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; position: relative; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 18px 18px 10px; }
.list-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -.03em; margin: 0; flex: 1; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 14px 10px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; color: var(--mute); }
.search:focus-within { border-color: var(--line-2); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; padding: 9px 0; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.list { overflow-y: auto; flex: 1; min-height: 0; padding: 2px 8px 80px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; position: relative; border: 1px solid transparent; transition: background .15s; }
.item + .item { margin-top: 1px; }
.item:hover { background: var(--bg-2); }
.item.on { background: var(--bg-3); border-color: var(--line); }
.item .who { font-weight: 500; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .when { font: 500 11.5px var(--mono); color: var(--mute); align-self: center; }
.item .subj { grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--soft); font-size: 13.5px; }
.item .snip { grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mute); font-size: 12.5px; }
.item.unread .who, .item.unread .subj { color: var(--text); font-weight: 600; }
.item.unread::before { content: ""; position: absolute; left: 3px; top: 17px; width: 5px; height: 5px; border-radius: 50%; background: var(--text); }
.item .tags { display: inline-flex; gap: 6px; margin-left: 6px; color: var(--mute); font-size: 11px; vertical-align: 1px; }
.item .tags .star { color: var(--gold); }
.item .to-tag { font: 500 10.5px var(--mono); color: var(--mute); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-right: 6px; }
.list .blank { padding: 60px 20px; text-align: center; color: var(--mute); font-size: 13.5px; }
.more { margin: 0 auto 16px; display: block; }

.read-pane { overflow-y: auto; min-height: 0; background: var(--bg); }
.empty-read { height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--mute); opacity: .8; }
.empty-read img { image-rendering: pixelated; opacity: .55; }
.empty-read p { margin: 0; font-size: 13.5px; }
.read-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; padding: 10px 18px; background: rgba(24,25,28,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.read-top .grow { flex: 1; }
.read-body { padding: 22px 28px 60px; max-width: 900px; }
.read-body h1 { font-size: 22px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 18px; line-height: 1.2; overflow-wrap: anywhere; }
.msg { border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.msg-head { display: flex; gap: 12px; padding: 14px 16px; cursor: pointer; align-items: flex-start; }
.msg.open .msg-head { cursor: default; border-bottom: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #141518; }
.msg-who { flex: 1; min-width: 0; }
.msg-who .n { font-weight: 600; }
.msg-who .e { color: var(--mute); font-size: 12.5px; margin-left: 6px; }
.msg-who .t { color: var(--mute); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-when { font: 500 11.5px var(--mono); color: var(--mute); white-space: nowrap; }
.msg-text { padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ice); font-size: 14.5px; line-height: 1.6; }
.msg-text a { color: #fff; }
.msg-frame { display: block; width: 100%; height: 520px; border: 0; background: #fff; resize: vertical; }
.msg:not(.open) .msg-body { display: none; }
.msg:not(.open) .msg-who .t { display: block; }
.warn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--soft); padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.warn.bad { color: var(--red); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.att { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--soft); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; font-size: 12.5px; max-width: 100%; }
.att:hover { color: var(--text); border-color: var(--line-3); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att small { color: var(--mute); font-family: var(--mono); }
.reply-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(8,9,10,.6); backdrop-filter: blur(3px); z-index: 20; }
.sheet { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.sheet-card { pointer-events: auto; width: 100%; max-width: 680px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 40px 100px -30px rgba(0,0,0,.8); padding: 6px 20px 18px; animation: pop .22s var(--ease); }
.sheet-card.narrow { max-width: 460px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 6px; }
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.row label { width: 62px; flex: none; color: var(--mute); font-size: 13px; }
.row input { border: 0; background: transparent; padding: 8px 0; border-radius: 0; }
.from-wrap { display: flex; align-items: center; flex: 1; min-width: 0; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 9px; padding-right: 10px; }
.from-wrap input { border: 0 !important; background: transparent; text-align: right; padding-right: 2px; min-width: 0; }
.row .from-wrap { background: transparent; border: 0; padding: 0; }
.row .from-wrap input { text-align: left; flex: 0 1 auto; width: auto; field-sizing: content; min-width: 4ch; max-width: 60%; }
.to-wrap { flex: 1; position: relative; min-width: 0; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.6); }
.suggest button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 7px; padding: 7px 10px; font-size: 13px; color: var(--soft); }
.suggest button:hover, .suggest button.on { background: var(--bg-4); color: var(--text); }
.suggest small { color: var(--mute); margin-left: 6px; }
#f-body { width: 100%; min-height: 240px; resize: vertical; background: transparent; border: 0; outline: none; padding: 14px 0; line-height: 1.6; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files .att button { background: none; border: 0; color: var(--mute); padding: 0 0 0 4px; }
.sheet-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 8px; }
.sheet-foot .err { flex-basis: 100%; }
.attach { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.chips button { background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; color: var(--soft); }
.chips .mute { font-size: 12.5px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--bg-4); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 16px; font-size: 13.5px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.7); max-width: calc(100vw - 32px); }
.fab { position: absolute; right: 18px; bottom: 22px; width: 52px; height: 52px; border-radius: 16px; border: 0; background: linear-gradient(180deg, #f4f5f7, #d9dbe0); color: #141518; display: grid; place-items: center; box-shadow: 0 14px 30px -10px rgba(0,0,0,.7); }
.only-phone { display: none; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 210px minmax(280px, 340px) 1fr; }
  .read-body { padding: 18px 18px 60px; }
}
@media (max-width: 820px) {
  .only-phone { display: inline-grid; }
  .app { grid-template-columns: 1fr; position: relative; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); z-index: 25; transform: translateX(-102%); transition: transform .28s var(--ease); }
  .app.menu .side { transform: none; box-shadow: 30px 0 60px -20px rgba(0,0,0,.7); }
  .list-pane { border-right: 0; }
  .read-pane { position: fixed; inset: 0; z-index: 15; transform: translateX(102%); transition: transform .28s var(--ease); }
  .app.reading .read-pane { transform: none; }
  .read-body { padding: 16px 16px 60px; }
  .read-body h1 { font-size: 19px; }
  .msg-head { padding: 12px; }
  .msg-who .e { display: block; margin-left: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msg-text { padding: 14px; }
  .msg-frame { height: 440px; }
  .sheet { padding: 0; place-items: end stretch; }
  .sheet-card, .sheet-card.narrow { max-width: none; border-radius: 16px 16px 0 0; max-height: 94dvh; padding: 4px 16px 18px; }
  .search kbd, #send-hint { display: none; }
  .row .from-wrap input { max-width: 50%; }
}
.sig-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--soft); padding: 4px 0 10px; cursor: pointer; min-width: 0; }
.sig-row input { accent-color: #e4e6eb; margin: 0; flex: none; }
.sig-row img { image-rendering: pixelated; flex: none; }
.sig-row .mute { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.presets { margin-bottom: 2px; }
.presets button { cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.presets button:hover { color: var(--text); border-color: var(--line-3); }
.presets button.on { background: var(--bg-4); color: var(--text); border-color: var(--line-3); }
.sig-preview { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 10px; padding: 12px 14px; margin-top: 4px; }
.sig-preview img { image-rendering: pixelated; flex: none; padding-right: 12px; border-right: 1px solid #e3e4e8; box-sizing: content-box; }
.sig-lines { font: 12.5px/1.5 -apple-system, "Segoe UI", system-ui, sans-serif; color: #5b5f69; min-width: 0; overflow-wrap: anywhere; }
.sig-lines b { display: block; color: #111; font-size: 13.5px; font-weight: 600; }
.box-hint { padding: 0 10px; margin: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
