:root {
  --r-lg: 17px;
  --surface: #15111e;
}

#fx-bg {
  inset: -14px;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
  filter: blur(clamp(14px, 2.4vw, 36px));
}

.topbar {
  height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr);
  padding-inline: clamp(14px, 3vw, 48px);
  background: linear-gradient(180deg, #09080cee, #09080cb0);
  backdrop-filter: none;
}
.topbar-actions { justify-self: end; }
.brand-logo { border-radius: 11px; }
.mail-dock {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: rgba(15, 13, 23, .95);
  box-shadow: 0 14px 28px #0005, inset 0 1px #ffffff0b;
}
.mail-dock > .nav-pill, .dock-menu > summary {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 13px;
  transition: background .18s, translate .18s, color .18s;
}
.mail-dock .nav-pill svg { width: 16px; height: 16px; }
.mail-dock > .nav-pill > svg, .dock-menu > summary > svg {
  transform: translateY(calc(var(--dock-lift, 0) * -4px)) scale(calc(1 + .26 * var(--dock-lift, 0)));
  transition: transform .18s ease-out;
}
.topbar .new-message { white-space: nowrap; border-radius: 12px; }
.mail-dock .nav-pill.active {
  color: var(--accent-text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.mail-dock .nav-pill.active::after { display: none; }
.mail-dock > .nav-pill:hover, .dock-menu > summary:hover { translate: 0 -2px; }
.mail-dock .nav-badge { margin-left: 1px; }
.brand, .topbar-actions { min-width: 0; }
.workspace {
  height: calc(100dvh - 74px);
  grid-template-columns: 280px minmax(330px, .87fr) minmax(300px, 1.15fr);
  gap: 16px;
  padding: 22px clamp(14px, 2.8vw, 42px) 25px;
}
.pane-inbox, .pane-reader, .rail-left { min-width: 0; }
.page-section { padding-top: 25px; }
.card { background: linear-gradient(145deg, #100e17e6, #0d0b12d1); }
.card-title { font-size: 13px; letter-spacing: .01em; text-transform: none; }
.hero { background: linear-gradient(152deg, #19112bdd, #110d18e8); }

details[data-popover] > summary { list-style: none; cursor: pointer; }
details[data-popover] > summary::-webkit-details-marker { display: none; }
.popover-surface, .settings-panel.popover-surface {
  position: fixed;
  inset: auto;
  z-index: 70;
  margin: 0;
  box-sizing: border-box;
  padding: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  height: auto;
  overflow: auto;
  border: 1px solid #ffffff24;
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 22px 54px #000b, inset 0 1px #ffffff08;
}
details[data-popover]:not([open]) > .popover-surface { display: none; }
.dock-options, .action-options { min-width: 170px; }
.dock-options .nav-pill, .action-options .btn {
  width: 100%;
  min-height: 35px;
  justify-content: flex-start;
  background-color: transparent;
  border-color: transparent;
  border-radius: 8px;
}
.dock-options .nav-pill:hover, .action-options .btn:hover { background-color: var(--accent-soft); }
.settings-panel.popover-surface {
  width: min(292px, calc(100vw - 24px));
  padding: 14px;
  gap: 10px;
}
.settings-label { font-weight: 600; }
.settings-label:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.preference-row {
  display: grid;
  width: 100%;
  grid-template-columns: 67px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}
.preference-row input { width: 100%; accent-color: var(--accent); }
.dd-menu { border-radius: 12px; background: var(--surface); padding: 6px; }
.dd-option { min-height: 34px; }
.settings-panel select, .compose-side select {
  width: 100%;
  min-height: 35px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--input-bg);
  font: inherit;
}

.compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(265px, 325px);
  gap: 18px;
  align-items: start;
  max-width: 1080px;
  width: 100%;
  margin-inline: auto;
}
.compose-main { padding: clamp(16px, 2.6vw, 29px); }
.compose-main h2 { font-size: clamp(21px, 3vw, 28px); margin: 0 0 15px; }
.compose-side { display: grid; gap: 14px; min-width: 0; }
.compose-side .field { margin-bottom: 10px; }
.compose-address-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}
.compose-address-row label { width: 45px; flex: 0 0 auto; color: var(--text-dim); }
.compose-address-row input {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: none;
  padding-inline: 5px;
}
.compose-address-row input:focus { box-shadow: none; }
.compose-main textarea {
  display: block;
  width: 100%;
  min-height: 200px;
  resize: vertical;
  margin: 12px 0;
  padding: 14px;
  background: #0c0a12a3;
}
.compose-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.compose-file-label { cursor: pointer; position: relative; }
.compose-file-label input { opacity: 0; cursor: pointer; position: absolute; inset: 0; width: 100%; min-width: 0; }
.compose-file-label:focus-within { outline: 2px solid var(--accent-text); outline-offset: 3px; }
#compose-file-status { overflow-wrap: anywhere; }
#compose-status[data-kind="success"] { color: var(--ok); }
#compose-status[data-kind="error"] { color: var(--bad); }
#compose-file-status:empty, #compose-status:empty { display: none; }
#compose-history { list-style: none; margin: 0; padding: 0; }
#compose-history li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#compose-history span { color: var(--text-dim); font-size: 11px; }
[hidden] { display: none !important; }

@media (max-width: 1060px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); height: auto; overflow: visible; }
  .pane-reader { grid-column: 1 / -1; }
}
@media (min-width: 1061px) {
  .pane-reader { min-height: 0; grid-column: auto; }
}
@media (max-width: 1059px) {
  body { padding-bottom: 78px; }
  .topbar { height: 57px; display: flex; justify-content: space-between; }
  .mail-dock {
    position: fixed;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 50%;
    translate: -50% 0;
    max-width: calc(100% - 16px);
    box-shadow: 0 7px 28px #000a;
  }
  .mail-dock > .nav-pill, .dock-menu > summary { padding-inline: 9px; font-size: 11px; }
  .mail-dock .nav-pill svg { width: 13px; height: 13px; }
  .workspace, .compose-layout { grid-template-columns: 1fr; }
  .pane-reader { min-height: 220px; }
}
@media (max-width: 390px) {
  .mail-dock > .nav-pill svg, .dock-menu > summary svg { display: none; }
  #btn-budget { display: none; }
  #btn-cmdk { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mail-dock .nav-pill { transition: none; }
  .mail-dock > .nav-pill:hover, .dock-menu > summary:hover { translate: none; }
}

#fx-bg {
  inset: 0;
  width: 100%;
  height: 100%;
  filter: none;
}
.mail-dock {
  background: linear-gradient(160deg, #242037eb, #100e19f5);
  border-color: #b6a4fb33;
  box-shadow: 0 12px 32px #0009, inset 0 1px #e6deff20;
}
.topbar { background: linear-gradient(180deg, #0b0813ef, #0b0813b0); }
.card { background: linear-gradient(160deg, #100d19e0, #0a0913d9); }
.hero { background: linear-gradient(152deg, #1d1535eb, #100e1bdd); }
.access-dialog {
  width: min(390px, calc(100vw - 28px));
  padding: 24px;
  color: var(--text);
  background: #15111e;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
}
.access-dialog::backdrop { background: #080612cf; backdrop-filter: blur(7px); }
.access-dialog h2 { margin: 0 0 8px; }
.access-dialog form { display: grid; gap: 12px; }
.access-dialog .btn { justify-self: start; }
