/* TempMaily styles. Colors are CSS variables per theme (dark = reference design). */

:root,
[data-theme="dark"] {
  --bg: #141414;
  --bg-top: #161616;
  --bg-side: #1c1c1c;
  --bg-list: #181818;
  --bg-raised: #232323;
  --bg-active: #2a2a2a;
  --bg-input: #111111;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #ececec;
  --text-body: #c8c8c8;
  --text-muted: #a3a3a3;
  --text-faint: #6b6b6b;
  --text-ghost: #3f3f3f;
  --btn: #3a3a3a;
  --btn-hover: #474747;
  --btn-text: #ffffff;
  --primary-bg: #f2f2f2;
  --primary-hover: #ffffff;
  --primary-text: #111111;
  --danger: #ef4444;
  --link: #8ab4ff;
  --focus: #7aa7ff;
  --logo-ink: #161616;
  --bg-card: #232323;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-top: #fafafa;
  --bg-side: #f5f5f5;
  --bg-list: #fbfbfb;
  --bg-raised: #eeeeee;
  --bg-active: #e7e7e7;
  --bg-input: #ffffff;
  --border: #e5e5e5;
  --border-strong: #d0d0d0;
  --text: #161616;
  --text-body: #333333;
  --text-muted: #5c5c5c;
  --text-faint: #8f8f8f;
  --text-ghost: #c7c7c7;
  --btn: #e6e6e6;
  --btn-hover: #d9d9d9;
  --btn-text: #161616;
  --primary-bg: #161616;
  --primary-hover: #000000;
  --primary-text: #ffffff;
  --danger: #dc2626;
  --link: #1d4ed8;
  --focus: #2563eb;
  --logo-ink: #fafafa;
  --bg-card: #ffffff;
  --shadow: 0 12px 40px rgba(0, 0, 0, .15);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
a { color: var(--link); }
img, svg { display: block; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--primary-bg); color: var(--primary-text); padding: 8px 12px; z-index: 10; }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 3px;
  background: var(--btn); color: var(--btn-text); font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); }
.btn-primary { background: var(--primary-bg); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-ghost:hover { background: var(--bg-raised); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.1); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 13px; }
button:disabled { opacity: .45; cursor: default; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 6px;
  background: none; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-raised); }
.is-spinning .icon { animation: spin .7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; height: 62px; padding: 0 12px 0 20px;
  background: var(--bg-top); border-bottom: 1px solid var(--border); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; height: 100%; color: var(--text); text-decoration: none; }
.topbar .brand { padding-right: 22px; border-right: 1px solid var(--border); }
.logo-mark { color: var(--text); flex: none; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.topnav { display: flex; height: 100%; margin-left: 8px; }
.topnav a { display: flex; align-items: center; padding: 0 14px; color: var(--text-muted); text-decoration: none; font-size: 16px; }
.topnav a:hover, .topnav a[aria-current] { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.theme-toggle .when-light { display: none; }
[data-theme="light"] .theme-toggle .when-dark { display: none; }
[data-theme="light"] .theme-toggle .when-light { display: inline-flex; }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu-panel {
  position: absolute; right: 0; top: 46px; min-width: 200px; padding: 6px;
  background: var(--bg-side); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.mobile-menu-panel a { padding: 10px 12px; color: var(--text); text-decoration: none; border-radius: 4px; }
.mobile-menu-panel a:hover { background: var(--bg-raised); }

/* ---------- the app (3 panes) ---------- */
.app {
  display: grid;
  grid-template-columns: 320px minmax(280px, 400px) minmax(0, 1fr);
  height: clamp(560px, calc(100vh - 62px), 920px);
  height: clamp(560px, calc(100dvh - 62px), 920px);
  border-bottom: 1px solid var(--border);
}
.page-inbox .app { height: calc(100vh - 62px); height: calc(100dvh - 62px); min-height: 520px; border-bottom: 0; }
.app-side {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 16px;
  background: var(--bg-side); border-right: 1px solid var(--border); overflow-y: auto;
}
.label { display: block; color: var(--text-muted); font-size: 14px; }

/* address card */
.side-card { padding: 18px 16px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; }
.address-row { display: flex; gap: 8px; margin-top: 10px; }
.address-input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px;
  background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 2px;
  color: var(--text); font-size: 15px;
}
.address-input:focus { outline: none; border-color: var(--focus); }
.btn-copy { min-width: 88px; height: 42px; gap: 6px; padding: 0 12px; }
.btn-copy.is-copied { background: #16a34a; color: #fff; }
.timer-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 16px; }
.countdown { font-size: 20px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.countdown.is-low { color: var(--danger); }
.timer-bar { height: 6px; margin-top: 10px; background: var(--bg-active); border-radius: 3px; overflow: hidden; }
.timer-bar-fill { display: block; width: 100%; height: 100%; background: var(--text-muted); border-radius: 3px; transition: width 1s linear; }
.timer-bar-fill.is-low { background: var(--danger); }

/* action tiles (2 x 2) */
.side-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  min-height: 92px; padding: 16px; background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 16px; text-align: left; cursor: pointer;
}
.tile:hover:not(:disabled) { background: var(--bg-raised); border-color: var(--border-strong); }
.tile .icon { color: var(--text-muted); }
.tile--danger, .tile--danger .icon { color: var(--danger); }

/* how it works */
.side-howto { padding: 16px; border: 1px dashed var(--border-strong); border-radius: 4px; }
.side-howto-title { margin: 0 0 12px; color: var(--text-muted); font-size: 14px; }
.side-howto ol { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.side-howto li { display: flex; align-items: center; gap: 12px; color: var(--text-body); font-size: 15px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg-active); color: var(--text-muted);
  font-size: 13px; font-weight: 600;
}
.side-note { display: flex; gap: 10px; margin: auto 0 0; padding: 4px 2px 0; color: var(--text-faint); font-size: 13px; line-height: 1.5; }
.side-note .icon { flex: none; color: var(--text-muted); }

.app-list { background: var(--bg-list); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.pane-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  height: 58px; padding: 0 14px 0 22px; border-bottom: 1px solid var(--border);
}
.pane-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.pane-count { min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--primary-bg); color: var(--primary-text); font-size: 12px; font-weight: 600; letter-spacing: 0; text-align: center; line-height: 20px; }
.message-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.message-list:empty { display: none; }
.msg-item {
  display: grid; gap: 2px; width: 100%; padding: 14px 20px 14px 22px;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); text-align: left; text-decoration: none; cursor: pointer; position: relative;
}
.msg-item:hover { background: var(--bg-raised); }
.msg-item.is-selected { background: var(--bg-active); }
.msg-item.is-new::before { content: ""; position: absolute; left: 9px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--link); }
.msg-item-top { display: flex; gap: 8px; align-items: baseline; }
.msg-item-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.msg-item.is-new .msg-item-from, .msg-item.is-new .msg-item-subject { font-weight: 600; }
.msg-item-time { flex: none; color: var(--text-faint); font-size: 12px; }
.msg-item-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.msg-item-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-faint); }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; }
.empty-icon { color: var(--text-ghost); }
.empty-title { margin: 16px 0 6px; color: var(--text-muted); font-size: 18px; }
.empty-sub { margin: 0; color: var(--text-ghost); font-size: 14px; }

.app-view { background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.app-error { margin: 16px auto; max-width: 720px; padding: 12px 16px; border: 1px solid var(--danger); border-radius: 4px; color: var(--danger); text-align: center; }

/* ---------- message viewer (pane + full page) ---------- */
.msg { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.msg-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); flex: none; }
.msg-head-top { display: flex; gap: 12px; align-items: flex-start; }
.msg-subject { flex: 1; margin: 0 0 10px; font-size: 20px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.msg-meta { display: grid; gap: 3px; margin: 0; font-size: 14px; }
.msg-meta div { display: flex; gap: 8px; min-width: 0; }
.msg-meta dt { flex: none; width: 70px; color: var(--text-faint); }
.msg-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text-body); }
.msg-note { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; padding: 8px 12px; border-radius: 4px; background: var(--bg-raised); font-size: 13px; color: var(--text-muted); }
.msg-note--muted { margin: 0; border-radius: 0; padding: 6px 24px; }
.msg-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.msg-tools:empty { display: none; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.seg { padding: 0 12px; line-height: 30px; font-size: 13px; color: var(--text-muted); background: none; border: 0; text-decoration: none; cursor: pointer; }
.seg.is-active { background: var(--bg-active); color: var(--text); }
.msg-body-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.msg-frame { flex: 1; width: 100%; min-height: 320px; border: 0; background: #fff; }
.msg-text { flex: 1; overflow: auto; margin: 0; padding: 20px 24px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; color: var(--text-body); }
.msg-page { max-width: 960px; margin: 0 auto; padding: 16px 16px 32px; }
.msg-page .msg { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg); }
.msg-frame--page { height: calc(100vh - 300px); height: calc(100dvh - 300px); min-height: 420px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* ---------- dialogs ---------- */
.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-side); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog-body { padding: 24px; }
.dialog h2 { margin: 0 0 8px; font-size: 20px; }
.dialog p { margin: 0 0 12px; color: var(--text-muted); font-size: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.qr-box { width: fit-content; margin: 8px auto 0; padding: 10px; background: #fff; border-radius: 6px; }
.qr-box img { width: 246px; height: 246px; }
.custom-row { display: flex; align-items: center; margin-top: 6px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 2px; }
.custom-row:focus-within { border-color: var(--focus); }
.custom-row input { flex: 1; min-width: 0; height: 42px; padding: 0 0 0 12px; border: 0; background: transparent; outline: none; }
.custom-domain { padding: 0 12px 0 2px; color: var(--text-muted); }
.form-hint { margin-top: 8px !important; font-size: 13px !important; color: var(--text-faint) !important; }
.form-error { color: var(--danger) !important; font-size: 14px !important; }

/* ---------- ads ---------- */
.below-app { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.below-app .ad { margin: 40px 0 0; }
.ad { margin: 36px 0; }
.ad-label { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); text-align: center; }
.ad-unit { display: block; width: 100%; overflow: hidden; }
.ad--below-app .ad-unit { height: 250px; }
.ad--in-content .ad-unit { height: 280px; }
.ad--sidebar { position: sticky; top: 24px; margin: 0; }
.ad--sidebar .ad-unit { width: 300px; height: 600px; }
.ad-placeholder { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-strong); border-radius: 4px; color: var(--text-faint); font-size: 13px; }

/* ---------- content pages ---------- */
.content-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 48px 20px 72px; }
.content-main { min-width: 0; max-width: 760px; }
.content-side { display: none; }
.prose { color: var(--text-body); font-size: 17px; line-height: 1.7; }
.prose h1 { margin: 0 0 16px; color: var(--text); font-size: clamp(28px, 4.2vw, 40px); line-height: 1.15; letter-spacing: -.02em; }
.prose h2 { margin: 48px 0 12px; color: var(--text); font-size: 25px; line-height: 1.25; letter-spacing: -.01em; }
.prose h3 { margin: 28px 0 8px; color: var(--text); font-size: 19px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose a { text-underline-offset: 3px; }
.prose code { padding: 2px 6px; border-radius: 4px; background: var(--bg-raised); font-size: .88em; }
.prose strong { color: var(--text); }
.prose blockquote { margin: 0 0 16px; padding: 4px 0 4px 18px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15px; }
.prose th, .prose td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.lead { font-size: 19px; color: var(--text-muted); }
.page-meta { color: var(--text-faint); font-size: 14px; margin-bottom: 24px !important; }
.steps { padding-left: 22px; }
.steps li { padding-left: 6px; margin-bottom: 12px; }
.feature-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 560px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.feature { padding: 20px; background: var(--bg-side); border: 1px solid var(--border); border-radius: 6px; }
.feature .icon { color: var(--text-muted); }
.feature h3 { margin: 12px 0 6px; font-size: 17px; }
.feature p { margin: 0; font-size: 15px; line-height: 1.6; }
.faq-list { border-top: 1px solid var(--border); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; color: var(--text); font-weight: 600; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--text-faint); font-weight: 400; font-size: 20px; line-height: 1; }
.faq-item[open] summary::after { content: "–"; }
.faq-answer { padding: 0 0 8px; }
.more-link { font-weight: 600; }
.post-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.post-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-side); color: var(--text); text-decoration: none; }
.post-card:hover { border-color: var(--border-strong); }
.post-card-title { font-weight: 600; font-size: 17px; line-height: 1.35; }
.post-card-desc { color: var(--text-muted); font-size: 15px; line-height: 1.55; }
.post-card-meta { margin-top: auto; color: var(--text-faint); font-size: 13px; }
.post-list { display: grid; gap: 14px; }
.side-cta { margin-bottom: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-side); }
.side-cta-title { margin: 0 0 6px; font-weight: 600; }
.side-cta p { margin: 0 0 14px; color: var(--text-muted); font-size: 15px; }
.contact-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.contact-card { padding: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-side); }
.contact-card h2 { margin: 0 0 6px !important; font-size: 18px !important; }
.contact-card p { margin: 0 0 10px; font-size: 15px; }
.placeholder-note { padding: 2px 6px; border-radius: 3px; background: #facc15; color: #111; font-weight: 600; }
.center-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; padding: 48px 20px; text-align: center; }
.center-page h1 { margin: 16px 0 8px; font-size: 26px; }
.center-page p { margin: 0 0 20px; color: var(--text-muted); max-width: 460px; }
.big-code { margin: 0; font-size: 64px; color: var(--text-ghost); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-top); }
.footer-inner { display: grid; gap: 32px; max-width: 1180px; margin: 0 auto; padding: 40px 20px 24px; }
.footer .brand { height: auto; }
.footer-brand p { margin: 12px 0 0; max-width: 320px; color: var(--text-muted); font-size: 14px; }
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.footer-links h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.footer-links a { display: block; padding: 4px 0; color: var(--text-muted); text-decoration: none; font-size: 15px; }
.footer-links a:hover, .link-btn:hover { color: var(--text); }
.link-btn { display: block; padding: 4px 0; border: 0; background: none; color: var(--text-muted); font-size: 15px; text-align: left; cursor: pointer; }
.footer-copy { max-width: 1180px; margin: 0 auto; padding: 16px 20px 28px; color: var(--text-faint); font-size: 13px; }

/* ---------- responsive ---------- */
@media (min-width: 760px) {
  .footer-inner { grid-template-columns: 1fr 1.4fr; }
}
@media (min-width: 1100px) {
  .content-wrap { grid-template-columns: minmax(0, 1fr) 300px; }
  .content-side { display: block; }
}
@media (min-width: 1360px) {
  .app { grid-template-columns: 340px 420px minmax(0, 1fr); }
}

/* Tablet & phone: stacked app; messages open on their own page. */
@media (max-width: 1023px) {
  .app, .page-inbox .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; height: auto; min-height: 0; }
  .app-side { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .app-view { display: none; }
  .app-side { gap: 12px; padding: 16px; }
  .tile { min-height: 76px; gap: 10px; padding: 12px 14px; font-size: 15px; }
  .side-howto, .side-note { display: none; }   /* the page below explains it; keep the inbox close */
  .app-list { border-right: 0; min-height: 340px; }
  .message-list { overflow: visible; }
}
@media (max-width: 699px) {
  .topbar { padding: 0 8px 0 16px; height: 58px; }
  .topbar .brand { border-right: 0; padding-right: 0; }
  .topnav { display: none; }
  .mobile-menu { display: block; }
  .page-inbox .app { min-height: calc(100dvh - 58px); }
  .content-wrap { padding: 32px 16px 56px; }
  .prose { font-size: 16px; }
  .ad--below-app .ad-unit { height: 280px; }
  .footer-links { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .is-spinning .icon { animation: none; }
}
