:root {
  font-family: system-ui, -apple-system, sans-serif;
  color: #20243a;
  background: #f5f6fb;
  --accent: #5844cb;
  --muted: #636a80;
  --line: #e8eaf3;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 20px; height: 20px; display: block; }
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
aside { background: #fff; border-right: 1px solid var(--line); padding: 28px 18px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 10px 34px; color: inherit; text-decoration: none; font-size: 25px; font-weight: 770; letter-spacing: -.04em; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; color: white; background: var(--accent); border-radius: 12px; }
.primary { background: var(--accent); color: white; border: 0; border-radius: 11px; padding: 11px 17px; font-weight: 650; }
.primary:hover { background: #4734b6; }
.compose { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; box-shadow: 0 7px 16px #5844cb28; }
.nav-heading { margin: 32px 12px 10px; font-size: .75rem; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
nav { display: grid; gap: 4px; }
.folder { width: 100%; padding: 12px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 10px; background: none; color: var(--muted); text-align: left; font-size: .9rem; }
.folder:hover, .quiet:hover, .icon:hover { background: #f0eff8; }
.folder[aria-current] { color: #4935b5; background: #ede9ff; font-weight: 700; }
.count { margin-left: auto; font-variant-numeric: tabular-nums; }
.profile { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 20px 8px 0; }
.profile small { display: block; color: var(--muted); margin-top: 2px; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; height: 37px; width: 37px; border-radius: 12px; background: #eee9ff; color: #5239bd; font-size: .8rem; font-weight: 750; }
.tone-1 { background: #dff5ed; color: #216451; }
.tone-2 { background: #ffe9df; color: #8a4731; }
.tone-3 { background: #dfedff; color: #2d5088; }
.topbar { padding: 21px clamp(16px, 4vw, 52px); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 11px; background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 12px; padding: 0 13px; width: min(100%, 520px); }
.search:focus-within { outline: 2px solid var(--accent); }
.search input { background: none; border: 0; outline: none; width: 100%; min-width: 0; padding: 11px 0; }
.workspace { max-width: 1450px; margin: auto; padding: 33px clamp(16px, 4vw, 52px); }
h1 { font-size: clamp(1.65rem, 4vw, 2.4rem); margin: 0; letter-spacing: -.045em; }
.heading p { margin: 7px 0 24px; color: var(--muted); }
.surface { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 5px 16px #28346608; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-height: 58px; padding: 8px 15px; border-bottom: 1px solid var(--line); }
.toolbar label { display: inline-flex; gap: 8px; align-items: center; font-size: .875rem; color: var(--muted); }
.toolbar .total { margin-left: auto; color: var(--muted); font-size: .875rem; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.icon, .quiet { border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon { display: inline-grid; place-items: center; width: 34px; height: 34px; }
.menu { display: none; }
.quiet { padding: 8px 10px; font-size: .875rem; }
.row { display: grid; grid-template-columns: 23px 34px minmax(0,1fr); align-items: center; padding: 0 15px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; border-radius: 0 0 16px 16px; }
.row.unread { background: #faf9ff; }
.row:hover { background: #f3f1fe; }
.starred { color: #956000; }
.starred svg { fill: #ffcf67; }
.message { border: 0; background: none; display: grid; grid-template-columns: 37px minmax(95px, 1fr) minmax(120px, 2.6fr) auto; align-items: center; text-align: left; gap: 12px; padding: 15px 0 15px 7px; min-width: 0; }
.sender, .excerpt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.subject { font-weight: 600; }
.unread .sender, .unread .subject { font-weight: 750; }
.preview, time { color: var(--muted); font-size: .875rem; }
.unread .sender::before { content: ''; display: inline-block; margin-right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.reader { padding: 24px clamp(16px, 4vw, 40px) 36px; overflow-wrap: anywhere; }
.reader h2 { margin: 0 0 18px; }
.reader p { color: var(--muted); }
.reader .body { white-space: pre-wrap; line-height: 1.65; margin-top: 28px; }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 15px 65px #10162945; }
dialog::backdrop { background: #18163855; }
.dialog-header, .dialog-footer { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: #f6f4ff; }
.dialog-header { justify-content: space-between; }
.dialog-header h2 { margin: 0; font-size: 1.125rem; }
.field { display: flex; gap: 12px; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.field input { flex: 1; min-width: 0; border: 0; padding: 11px 4px; }
textarea { display: block; width: 100%; resize: vertical; min-height: 100px; border: 0; padding: 16px 18px; }
.toast { position: fixed; bottom: 18px; right: 18px; max-width: calc(100% - 36px); background: #29233f; color: white; padding: 12px 17px; border-radius: 10px; z-index: 4; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  aside { display: none; position: absolute; top: 70px; bottom: 0; z-index: 2; width: min(252px, 90vw); box-shadow: 12px 0 30px #20243a26; overflow: auto; }
  aside.open { display: flex; }
  .menu { display: inline-grid; flex-shrink: 0; }
  .topbar { padding-block: 12px; }
  .workspace { padding-top: 22px; }
  .message { grid-template-columns: 32px minmax(0,1fr) auto; gap: 4px 8px; }
  .message .avatar { grid-row: span 2; width: 32px; height: 32px; }
  .message time { grid-column: 3; grid-row: 1; }
  .excerpt { grid-column: 2 / -1; }
  .preview { display: none; }
}
