/* email.domainless.fun + email.jandgstudios.fun — webmail.
   Same JS bundle, different brand. We pick brand from <html data-brand>.
*/

:root {
  /* Domainless brand (default) */
  --bg: #1a1820;
  --panel: #0d0f1a;
  --panel-2: #14172a;
  --line: #232743;
  --line-2: #353a64;
  --accent: #c8a86e;
  --accent-2: #5cf2ff;
  --gold: #ffe24a;
  --green: #5cff8c;
  --red: #ff5c5c;
  --text: #f0eaff;
  --dim: #95a0c8;
  --hover: #1a1d34;
  --selected: #2a1652;
  --logo-font: "JetBrains Mono", ui-monospace, monospace;
  /* Chrome/tabs aliases */
  --bright: var(--text);
  --border: var(--line);
  --danger: var(--red);
  --card: var(--panel);
  --body-font: "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* J&G brand — restrained, parallax-friendly serif italics in places. */
[data-brand="jandg"] {
  --bg: #1a1820;
  --panel: #20202a;
  --panel-2: #27263a;
  --line: #353350;
  --line-2: #45446a;
  --accent: #c4b5fd;
  --accent-2: #fcd34d;
  --gold: #fcd34d;
  --green: #86efac;
  --red: #fca5a5;
  --text: #e7e0f0;
  --dim: #908ba0;
  --hover: #28273a;
  --selected: #353350;
  --logo-font: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--body-font);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
}
a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  color: var(--text);
}
button {
  font: inherit;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 12px;
  cursor: pointer;
  transition:
    border-color 0.14s,
    background 0.14s;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
input,
textarea,
select {
  font: inherit;
  background: #0a0c18;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 10px;
  outline: none;
}
[data-brand="jandg"] input,
[data-brand="jandg"] textarea,
[data-brand="jandg"] select {
  background: #1a1820;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

.btn-primary {
  background: linear-gradient(180deg, #2a1652, #1a0c34);
  border-color: var(--accent);
  color: var(--text);
  text-transform: uppercase;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  box-shadow: 0 0 12px rgba(255, 92, 243, 0.2);
}
[data-brand="jandg"] .btn-primary {
  background: linear-gradient(180deg, #2a253a, #1a1820);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(196, 181, 253, 0.18);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(255, 92, 243, 0.45);
}

/* ── Layout: 3-pane shell ──
   Sized to fit BETWEEN the shared chrome bars rather than under
   them. Chrome top bar is fixed at top:0 (height var(--dlc-bar-h));
   chrome bottom-nav, when present, fixes to bottom:0 (height var
   (--dlc-bn-h) + safe-area). The shell takes the remaining
   viewport so mail's columns stay visible without being hidden
   behind chrome. */
.shell {
  display: grid;
  grid-template-columns: 220px 380px 1fr;
  grid-template-rows: auto 1fr;
  height: calc(100vh - var(--dlc-bar-h, 40px));
}
html.dl-bn-present .shell {
  height: calc(
    100vh - var(--dlc-bar-h, 40px) - var(--dlc-bn-h, 50px) -
      env(safe-area-inset-bottom, 0px)
  );
}
.topbar {
  grid-column: 1 / 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--logo-font);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
}
.brand .pix {
  width: 18px;
  height: 18px;
  background:
    linear-gradient(45deg, var(--accent) 25%, transparent 25%) 0 0/6px 6px,
    linear-gradient(-45deg, var(--accent-2) 25%, transparent 25%) 0 0/6px 6px,
    var(--bg);
}
.brand .b1 {
  color: var(--accent);
}
.brand .b2 {
  color: var(--text);
}
.topbar nav {
  display: flex;
  gap: 12px;
  font-size: 12px;
  flex-wrap: wrap;
}
.topbar nav a {
  color: var(--dim);
}
.topbar nav a.active,
.topbar nav a:hover {
  color: var(--text);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

/* Sidebar */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar .compose {
  margin: 8px 12px 12px;
  width: calc(100% - 24px);
  padding: 9px 14px;
  font-weight: 700;
}
.folder-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.folder-list li {
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-left: 2px solid transparent;
}
.folder-list li:hover {
  background: var(--hover);
  color: var(--text);
}
.folder-list li.active {
  background: var(--selected);
  color: var(--text);
  border-left-color: var(--accent);
}
.folder-list li .badge {
  font-family: var(--logo-font);
  font-size: 10px;
  color: var(--accent-2);
}

/* Message list */
.list-pane {
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}
.list-head input[type="text"] {
  flex: 1;
}
.list-head button {
  padding: 4px 10px;
  font-size: 12px;
}

.msg-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
}
.msg-row:hover {
  background: var(--hover);
}
.msg-row.selected {
  background: var(--selected);
}
.msg-row.unseen .msg-from,
.msg-row.unseen .msg-subject {
  font-weight: 700;
  color: var(--text);
}
.msg-row .msg-from {
  font-size: 13px;
  color: var(--text);
}
.msg-row .msg-date {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--logo-font);
  text-align: right;
}
.msg-row .msg-subject {
  font-size: 13px;
  color: var(--text);
  margin-top: 1px;
}
.msg-row .msg-snippet {
  grid-column: 1 / 3;
  font-size: 12px;
  color: var(--dim);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reader */
.reader {
  overflow-y: auto;
  background: var(--bg);
}
.reader .reader-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.reader .subject {
  margin: 0 0 8px;
  font-size: 18px;
}
.reader .meta {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}
.reader .meta b {
  color: var(--text);
}
.reader .actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.reader .actions button {
  padding: 4px 10px;
  font-size: 12px;
}
.reader-body {
  padding: 16px 22px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}
.reader-body iframe {
  width: 100%;
  min-height: 60vh;
  border: 0;
  background: #fff;
}

.empty-pane {
  padding: 36px;
  text-align: center;
  color: var(--dim);
  font-family: var(--logo-font);
}

/* Compose modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay.open {
  display: flex;
}
.compose-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  width: min(720px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.compose-modal h2 {
  margin: 0;
  padding: 14px 18px;
  font-family: var(--logo-font);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
}
.compose-modal .fields {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.compose-modal .row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: center;
}
.compose-modal .row label {
  font-family: var(--logo-font);
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.compose-modal textarea#compose-body {
  flex: 1;
  min-height: 220px;
  resize: vertical;
  font-family: var(--logo-font);
  font-size: 13px;
  line-height: 1.5;
}
.compose-modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.flash {
  margin: 8px 12px;
  padding: 8px 12px;
  border: 1px solid;
  font-size: 12px;
  font-family: var(--logo-font);
}
.flash.ok {
  color: var(--green);
  border-color: var(--green);
}
.flash.err {
  color: var(--red);
  border-color: var(--red);
}
.flash.info {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

/* ════════════════════════════════════════════════════════════════════
   Signed-out landing card.
   Replaces the empty webmail shell when there's no token or SSO cookie.
   Centered hero with sign-in CTA — same brand language as the rest of
   the ecosystem's landing surfaces.
   ════════════════════════════════════════════════════════════════════ */
.signed-out-landing {
  /* Normal block flow — the chrome bar is position:fixed and consumes 48px
     (44px mobile) at the top, so we add matching padding-top instead of
     using position:fixed + top:N + align-items:center, which clipped the
     top of the hero when content exceeded viewport height. */
  min-height: calc(100vh - 48px);
  padding: 88px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(
      ellipse 80% 60% at 50% 0%,
      rgba(255, 92, 243, 0.1),
      transparent 70%
    ),
    var(--bg);
}
@media (max-width: 640px) {
  .signed-out-landing {
    min-height: calc(100vh - 44px);
    padding-top: 76px;
  }
}
.sol-cta-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim, #95a0c8);
  max-width: 480px;
  margin: 8px auto 24px;
  text-align: center;
}
.sol-inner {
  max-width: 620px;
  width: 100%;
  text-align: center;
}
.sol-eyebrow {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent, #c8a86e);
  margin-bottom: 28px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 92, 243, 0.3);
  border-radius: 999px;
  background: rgba(255, 92, 243, 0.06);
  display: inline-block;
}
.sol-title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: var(--text, #f0eaff);
  font-weight: 400;
}
.sol-title em {
  font-style: italic;
  background: linear-gradient(180deg, #c8a86e, #5cf2ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sol-sub {
  font-size: 17px;
  color: var(--dim, #95a0c8);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 32px;
}
.sol-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.sol-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    transform 0.12s,
    background 0.14s,
    border-color 0.14s;
}
.sol-cta-primary {
  background: var(--accent, #c8a86e);
  color: #000;
}
.sol-cta-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.sol-cta-secondary {
  background: transparent;
  border: 1px solid var(--line, #232743);
  color: var(--dim, #95a0c8);
}
.sol-cta-secondary:hover {
  color: var(--text, #f0eaff);
  border-color: var(--accent, #c8a86e);
}
.sol-bullets {
  list-style: none;
  padding: 0;
  margin: 0 auto 28px;
  max-width: 520px;
  text-align: left;
}
.sol-bullets li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--dim, #95a0c8);
  font-size: 14px;
  line-height: 1.6;
}
.sol-bullets li:last-child {
  border-bottom: none;
}
.sol-bullets strong {
  color: var(--text, #f0eaff);
  font-weight: 600;
}
.sol-bullets code {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent-2, #5cf2ff);
}
.sol-foot {
  font-size: 13px;
  color: var(--dim, #95a0c8);
}
.sol-foot a {
  color: var(--accent, #c8a86e);
  text-decoration: none;
}
.sol-foot a:hover {
  text-decoration: underline;
}

[data-brand="jandg"] .signed-out-landing {
  background:
    radial-gradient(
      ellipse 80% 60% at 50% 0%,
      rgba(200, 168, 110, 0.08),
      transparent 70%
    ),
    var(--bg);
}
[data-brand="jandg"] .sol-eyebrow {
  color: #c8a86e;
  border-color: rgba(200, 168, 110, 0.3);
  background: rgba(200, 168, 110, 0.06);
}
[data-brand="jandg"] .sol-title em {
  background: linear-gradient(180deg, #c8a86e, #d4b87a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-brand="jandg"] .sol-cta-primary {
  background: #c8a86e;
}
[data-brand="jandg"] .sol-cta-secondary:hover {
  border-color: #c8a86e;
}
[data-brand="jandg"] .sol-foot a,
[data-brand="jandg"] .sol-bullets code {
  color: #c8a86e;
}

/* ── Sign-in form on the signed-out landing ────────────────────────── */
.sol-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  margin: 4px auto 16px;
  text-align: left;
}
.sol-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sol-label {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--dim, #95a0c8);
}
.sol-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line, #232743);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text, #f0eaff);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.sol-input:hover:not(:focus) {
  border-color: rgba(255, 92, 243, 0.3);
}
.sol-input:focus {
  border-color: var(--accent, #c8a86e);
  background: rgba(255, 92, 243, 0.04);
  box-shadow: 0 0 0 3px rgba(255, 92, 243, 0.18);
}
.sol-field-hint {
  font-size: 11px;
  color: var(--dim, #95a0c8);
  line-height: 1.5;
}
.sol-form-err {
  font-size: 13px;
  color: #ff5c5c;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
}
.sol-form-err .sol-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent, #c8a86e);
}
.settings-section {
  margin: 0 0 22px;
  text-align: left;
}
.settings-section-title {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent, #c8a86e);
  margin: 0 0 4px;
  text-align: center;
}
.settings-section-sub {
  font-size: 12px;
  color: var(--dim, #95a0c8);
  margin: 0 0 12px;
  line-height: 1.5;
  text-align: center;
}
.settings-divider {
  border: 0;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  margin: 22px 0;
}
.sol-handle-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.sol-handle-row .sol-input {
  border-radius: 8px 0 0 8px;
  border-right: 0;
}
.sol-handle-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--dim, #95a0c8);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  border-radius: 0 8px 8px 0;
  white-space: nowrap;
}
.sol-notice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(200, 168, 110, 0.08);
  border: 1px solid var(--accent, #c8a86e);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #e8e3d8);
}
.sol-notice strong {
  color: var(--bright, #fff);
  font-size: 14px;
}
.sol-notice .sol-cta {
  margin-top: 6px;
  align-self: stretch;
  text-align: center;
  text-decoration: none;
}
.sol-form .sol-cta-primary {
  display: flex;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  justify-content: center;
  font-family: inherit;
  border: none;
  cursor: pointer;
}
.sol-form .sol-cta-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}
.sol-link {
  color: var(--accent, #c8a86e);
  text-decoration: none;
}
.sol-link:hover {
  text-decoration: underline;
}

[data-brand="jandg"] .sol-input:hover:not(:focus) {
  border-color: rgba(200, 168, 110, 0.3);
}
[data-brand="jandg"] .sol-input:focus {
  border-color: #c8a86e;
  background: rgba(200, 168, 110, 0.04);
  box-shadow: 0 0 0 3px rgba(200, 168, 110, 0.18);
}
[data-brand="jandg"] .sol-link {
  color: #c8a86e;
}
