@font-face { font-family: "Outfit"; src: url("/assets/fonts/outfit.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #000; --bg-alt: #080808; --surface: #0e0e0e; --surface-2: #151515;
  --text: #f5f5f5; --muted: #8c8c8c; --faint: #4a4a4a;
  --border: #1f1f1f; --border-strong: #333;
  --accent: #8b7bff; --accent-2: #3dd6f5; --danger: #ff6b6b;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,123,255,.18); }
.mono { font-family: "JetBrains Mono", monospace; font-size: .75rem; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.error { color: var(--danger); font-size: .85rem; min-height: 1em; }

.btn { background: var(--text); color: #000; font-family: "Outfit", sans-serif; font-weight: 600; padding: 10px 18px; border-radius: 10px; }
.btn:hover { box-shadow: 0 6px 22px -6px rgba(139,123,255,.6); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn-ghost { border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: 10px; color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }
.btn-small { padding: 7px 14px; font-size: .85rem; }
.danger:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--border-strong); border-radius: 10px; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { color: var(--muted); font-size: .85rem; text-align: left; }
.link-btn:hover { color: var(--text); }

/* LOGIN */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; padding: 32px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.login-logo { height: 20px; width: auto; }

/* LAYOUT */
.app { display: grid; grid-template-columns: 220px 380px 1fr; height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; background: var(--bg-alt); min-height: 0; overflow-y: auto; }
.app { overflow: hidden; }
.side-logo { height: 16px; width: auto; margin: 4px 8px; }
.compose-btn { width: 100%; }
.folders { display: grid; gap: 2px; }
.folders button { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--muted); text-align: left; }
.folders button:hover { background: var(--surface-2); color: var(--text); }
.folders button.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.count { color: var(--accent-2); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--border); }
.side-foot-actions { display: flex; justify-content: space-between; }

.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.list-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--border); }
.list-title { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 6px; font-family: "Outfit", sans-serif; font-weight: 600; font-size: 1.1rem; }
.list { list-style: none; overflow-y: auto; flex: 1; }
.list li { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: grid; gap: 3px; position: relative; }
.list li:hover { background: var(--surface); }
.list li.selected { background: var(--surface-2); }
.list li.unread::before { content: ""; position: absolute; left: 6px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.list li.unread .l-from, .list li.unread .l-subject { color: var(--text); font-weight: 600; }
.l-row { display: flex; justify-content: space-between; gap: 10px; }
.l-from { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-date { color: var(--faint); font-size: .78rem; white-space: nowrap; }
.l-subject { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-snippet { color: var(--faint); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .empty-list { color: var(--faint); text-align: center; padding: 40px 16px; cursor: default; }
.tag-form { font-family: "JetBrains Mono", monospace; font-size: .65rem; color: var(--accent-2); border: 1px solid rgba(61,214,245,.35); border-radius: 5px; padding: 0 5px; margin-right: 6px; }

.read-pane { overflow-y: auto; min-width: 0; }
.empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; opacity: .6; }
.empty img { opacity: .25; }
.message { padding: 20px 32px 48px; display: grid; gap: 18px; max-width: 900px; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-subject { font-family: "Outfit", sans-serif; font-weight: 600; font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.25; margin-top: 6px; }
.msg-meta { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.meta-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.meta-date { white-space: nowrap; align-self: flex-start; padding-top: 4px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-family: "Outfit", sans-serif; font-weight: 600; font-size: .95rem; color: var(--text);
  background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
              linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
  border: 1.5px solid transparent;
}
.text-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px 26px; font-size: 15px; line-height: 1.7; color: #e8e8e8; word-wrap: break-word; }
.t-line { min-height: 1.7em; white-space: pre-wrap; }
.t-line.quote { color: var(--faint); border-left: 2px solid var(--border-strong); padding-left: 12px; }
.text-card a { color: var(--accent-2); text-underline-offset: 3px; }
.html-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.html-card iframe { display: block; width: 100%; height: 80px; border: 0; background: #fff; }
.badge { font-family: "JetBrains Mono", monospace; font-size: .68rem; color: var(--accent-2); border: 1px solid rgba(61,214,245,.35); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.attachments a { display: inline-block; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; color: var(--text); text-decoration: none; font-size: .82rem; }
.attachments a:hover { border-color: var(--accent); }

/* DIALOGS */
.dialog { margin: auto; width: min(680px, calc(100% - 24px)); background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 16px; padding: 0; }
.dialog-small { width: min(400px, calc(100% - 24px)); }
.dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog form { display: grid; gap: 12px; padding: 20px; }
.dialog label { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; }
.dialog textarea { resize: vertical; line-height: 1.55; }
.dialog-head, .dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-foot .error { flex: 1; text-align: right; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #000; padding: 10px 18px; border-radius: 10px; font-weight: 500; z-index: 100; }

.mobile-only { display: none; }

@media (max-width: 1100px) { .app { grid-template-columns: 200px 320px 1fr; } }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .mobile-only { display: inline-grid; place-items: center; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .read-pane { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .read-pane { display: block; }
  .message { padding: 16px; }
  .text-card { padding: 16px 18px; }
  .meta-date { display: none; }
}
