/* ──────────────────────────────────────
   Stroke — design system
   Flat woodblock-postcard palette: vermilion, mustard, teal on cream paper,
   print grain, and hard offset "misregistration" shadows instead of blur.
   ────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --vermilion: #E2461F;
  --vermilion-deep: #B73416;
  --mustard: #F2CC5B;
  --mustard-deep: #D9A92E;
  --teal: #89B1B5;
  --teal-deep: #4E7F86;
  --maroon: #6E1F12;
  --ink: #24160F;
  --paper: #F5ECD9;
  --paper-2: #EDE0C2;
  --card: #FBF6EA;
  --white: #FFFDF8;

  --text: var(--ink);
  --text-muted: #6B5646;
  --text-dim: #9A8573;
  --line: rgba(36 22 15 / .16);
  --line-strong: rgba(36 22 15 / .32);

  --success: #3E7D5A;
  --danger: #C5311A;
  --warn: #A9781A;

  /* aliases used by inline styles in script.js */
  --text-color: var(--text);
  --border-color: var(--line);
  --surface-border: var(--line);
  --primary: var(--vermilion);
  --primary-color: var(--teal-deep);

  --radius: 12px;
  --radius-sm: 7px;
  --shadow-hard: 4px 4px 0 var(--ink);
  --shadow-hard-sm: 3px 3px 0 var(--ink);
  --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --font-jp: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --ease: cubic-bezier(.3, .7, .2, 1);
  --t: .2s var(--ease);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .09 0 0 0 0 .06 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .98 0 0 0 0 .92 0 0 0 1.6 -.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* paper grain over everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: .28;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 20000;
}

::selection { background: var(--mustard); color: var(--ink); }
a { color: inherit; }
code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: .86em;
  background: rgba(36 22 15 / .07);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Landing vs dashboard ── */
#app { display: none; }
html.signed-in #landing { display: none; }
html.signed-in #app { display: block; }

/* ════════════════════════════════════════
   Shared atoms
   ════════════════════════════════════════ */

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.hanko {
  display: inline-flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl;
  width: 30px; height: 38px;
  background: var(--vermilion);
  color: var(--paper);
  font-family: var(--font-jp);
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .05em;
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--maroon);
  transform: rotate(-4deg);
}
.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -.03em;
  color: var(--ink);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--vermilion-deep);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--vermilion); box-shadow: 2px 2px 0 var(--mustard); }

/* Postcard surface: flat vermilion with print speckle */
.postcard {
  position: relative;
  background: var(--vermilion);
  isolation: isolate;
  overflow: hidden;
}
.postcard::after {
  content: '';
  position: absolute; inset: 0;
  background-image: var(--speckle);
  opacity: .22;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
}
.postcard-imprint {
  position: absolute;
  left: 18px; bottom: 18px;
  writing-mode: vertical-rl;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .18em;
  color: var(--ink);
  opacity: .78;
  z-index: 3;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-hard-sm);
  transition: transform var(--t), box-shadow var(--t), background var(--t), color var(--t);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--teal-deep); outline-offset: 3px; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-primary { background: var(--vermilion); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--vermilion-deep); }
.btn-mustard { background: var(--mustard); color: var(--ink); }
.btn-mustard:hover:not(:disabled) { background: #F6D677; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover:not(:disabled) { background: #3a2619; }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--white); border-color: var(--ink); box-shadow: var(--shadow-hard-sm); }
.btn-ghost-light { background: transparent; box-shadow: none; border-color: var(--paper); color: var(--paper); }
.btn-ghost-light:hover:not(:disabled) { background: rgba(255 253 248 / .12); box-shadow: 3px 3px 0 var(--maroon); }
.btn-danger-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { border-color: var(--danger); background: rgba(197 49 26 / .06); box-shadow: 3px 3px 0 var(--danger); }
.btn-sm { padding: 7px 13px; font-size: .84rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.link-btn { background: none; border: none; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ════════════════════════════════════════
   LANDING
   ════════════════════════════════════════ */

#landing { position: relative; }

.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  max-width: 1200px; margin: 0 auto;
  padding: 16px 28px;
  background: rgba(245 236 217 / .9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 2px solid transparent;
}
.site-links { display: flex; gap: 28px; }
.site-links a {
  font-weight: 600; font-size: .92rem; text-decoration: none; color: var(--text-muted);
  transition: color var(--t);
}
.site-links a:hover { color: var(--vermilion-deep); }
.site-actions { display: flex; gap: 10px; align-items: center; }

/* Hero */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 56px 28px 72px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 56px;
  align-items: center;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  line-height: .98;
  letter-spacing: -.04em;
  margin: 18px 0 22px;
  color: var(--ink);
}
.hero-title em {
  font-style: normal;
  color: var(--vermilion);
  text-shadow: 3px 3px 0 var(--mustard);
}
.nowrap { white-space: nowrap; }
@media (max-width: 480px) { .nowrap { white-space: normal; } }
.hero-sub { font-size: 1.15rem; color: var(--text-muted); max-width: 34em; }
.hero-sub strong { color: var(--ink); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero-note { margin-top: 16px; font-size: .85rem; color: var(--text-dim); }

.hero-art {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  border: 2px solid var(--ink);
  box-shadow: 10px 10px 0 var(--teal), 10px 10px 0 2px var(--ink);
  transform: rotate(1.5deg);
  max-width: 420px;
  justify-self: center;
  width: 100%;
}
.hero-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.hero-art .hero-svg g:first-of-type { animation: sway 7s ease-in-out infinite alternate; transform-origin: 200px 480px; }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }

/* Works-with strip */
.works-with {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 10px 16px;
  padding: 18px 28px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--mustard);
  font-size: .95rem;
}
.works-with span { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 700; color: var(--maroon); }
.works-with strong { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.works-with i { font-style: normal; color: var(--vermilion); font-weight: 800; }

/* Sections */
.section { max-width: 1200px; margin: 0 auto; padding: 96px 28px 0; }
.section-head { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 40px; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  max-width: 18em;
}
.section-kanji {
  position: absolute;
  top: -58px; left: -6px;
  font-family: var(--font-jp);
  font-weight: 800;
  font-size: 3.2rem;
  color: var(--vermilion);
  opacity: .14;
  letter-spacing: .1em;
  pointer-events: none;
}

/* Features */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature {
  position: relative;
  padding: 26px 22px 28px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  min-height: 250px;
  transition: transform var(--t), box-shadow var(--t);
  overflow: hidden;
  isolation: isolate;
}
.feature:hover { transform: translate(-2px, -3px) rotate(-.4deg); box-shadow: 7px 7px 0 var(--ink); }
.feature::after { content: ''; position: absolute; inset: 0; background-image: var(--speckle); opacity: .14; mix-blend-mode: screen; pointer-events: none; }
.feature h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1.15; letter-spacing: -.02em; margin: 22px 0 10px; }
.feature p { font-size: .95rem; }
.feature code { background: rgba(255 253 248 / .5); }
.feature-num { font-family: var(--font-display); font-weight: 800; font-size: .85rem; letter-spacing: .08em; padding: 3px 8px; border: 2px solid currentColor; border-radius: 99px; }
.tile-teal { background: var(--teal); color: var(--ink); }
.tile-mustard { background: var(--mustard); color: var(--ink); }
.tile-vermilion { background: var(--vermilion); color: var(--white); }
.tile-vermilion code { background: rgba(255 253 248 / .2); color: var(--white); }
.tile-paper { background: var(--white); color: var(--ink); }

/* How it works */
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 2px solid var(--ink); }
.steps li { padding: 28px 28px 8px 0; position: relative; }
.steps li + li { padding-left: 28px; border-left: 2px dashed var(--line-strong); }
.step-kanji {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px;
  font-family: var(--font-jp); font-weight: 800; font-size: 1.6rem;
  background: var(--ink); color: var(--mustard);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--vermilion);
}
.steps h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; margin: 18px 0 6px; }
.steps p { color: var(--text-muted); }

/* Pricing */
.billing-toggle {
  display: inline-flex; padding: 4px; gap: 4px;
  border: 2px solid var(--ink); border-radius: 99px; background: var(--white);
}
.billing-toggle button {
  border: none; background: transparent; font: inherit; font-weight: 700; font-size: .88rem;
  padding: 8px 16px; border-radius: 99px; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--t), color var(--t);
}
.billing-toggle button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.save-tag { font-size: .7rem; padding: 2px 7px; border-radius: 99px; background: var(--mustard); color: var(--ink); }
.billing-toggle.compact { margin: 6px 0 18px; }

.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.plan {
  position: relative;
  display: flex; flex-direction: column;
  padding: 30px 26px 26px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
}
.plan h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.plan-tagline { color: var(--text-muted); font-size: .92rem; margin-top: 2px; }
.plan-price { margin: 22px 0 18px; display: flex; align-items: baseline; gap: 8px; }
.plan-price .amount { font-family: var(--font-display); font-weight: 800; font-size: 3rem; letter-spacing: -.04em; line-height: 1; }
.plan-price .per { color: var(--text-muted); font-weight: 600; }
.plan-features { list-style: none; display: grid; gap: 10px; margin-bottom: 26px; flex: 1; }
.plan-features li { position: relative; padding-left: 26px; font-size: .95rem; }
.plan-features li::before {
  content: ''; position: absolute; left: 0; top: .3em;
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--teal); border: 2px solid var(--ink);
  transform: rotate(45deg) scale(.75);
}
.plan-featured { background: var(--mustard); transform: translateY(-10px); box-shadow: 8px 8px 0 var(--vermilion), 8px 8px 0 2px var(--ink); }
.plan-featured .plan-features li::before { background: var(--vermilion); }
.plan-badge {
  position: absolute; top: -15px; right: 20px;
  padding: 4px 12px;
  background: var(--vermilion); color: var(--white);
  border: 2px solid var(--ink); border-radius: 99px;
  font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(3deg);
}
.plan-footnote { margin-top: 26px; font-size: .82rem; color: var(--text-dim); }

/* FAQ */
.faq-list { display: grid; gap: 12px; max-width: 860px; }
.faq details {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  transition: box-shadow var(--t);
}
.faq details[open] { box-shadow: var(--shadow-hard-sm); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 18px 54px 18px 20px; position: relative;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mustard); border: 2px solid var(--ink);
  font-family: var(--font); font-weight: 800; line-height: 1;
  transition: transform var(--t), background var(--t);
}
.faq details[open] summary::after { content: '–'; background: var(--vermilion); color: var(--white); }
.faq details p { padding: 0 20px 20px; color: var(--text-muted); max-width: 46em; }

/* Closing CTA */
.closer {
  max-width: 1144px; margin: 110px auto 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 var(--teal), 10px 10px 0 2px var(--ink);
}
.closer-inner { position: relative; z-index: 3; padding: 72px 56px 72px 80px; color: var(--white); }
.closer h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.035em; max-width: 17em; }
.closer h2 em { font-style: normal; color: var(--mustard); text-shadow: 3px 3px 0 var(--maroon); }

/* Footer */
.site-footer {
  max-width: 1200px; margin: 80px auto 0;
  padding: 28px 28px 40px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
  border-top: 2px solid var(--ink);
  color: var(--text-muted); font-size: .88rem;
}
.site-footer nav { display: flex; gap: 20px; }
.site-footer nav a { text-decoration: none; font-weight: 600; }
.site-footer nav a:hover, .site-footer .link-btn:hover { color: var(--vermilion-deep); }
.site-footer .link-btn { text-decoration: none; font-weight: 600; }

/* ════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════ */

#app {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 72px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 12px 0 18px;
  margin-bottom: 26px;
  border-bottom: 2px solid var(--ink);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.worker-pill {
  display: inline-flex; align-items: center; gap: 7px;
  margin-left: 8px;
  padding: 4px 10px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: var(--teal);
  font-size: .74rem; font-weight: 700; letter-spacing: .03em;
  cursor: help;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--vermilion); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(226 70 31 / .6); }
  70% { box-shadow: 0 0 0 7px rgba(226 70 31 / 0); }
  100% { box-shadow: 0 0 0 0 rgba(226 70 31 / 0); }
}

#signed-out-view { display: none; }

.user-pill {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 8px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 99px;
  box-shadow: var(--shadow-hard-sm);
}
.user-pill .avatar[src=""] { visibility: hidden; }
.user-pill .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--teal); border: 2px solid var(--ink); }
.user-meta { line-height: 1.2; }
.user-name-row { display: flex; align-items: center; gap: 4px; }
.user-pill strong { font-size: .9rem; }
.user-pill .user-email-text { font-size: .76rem; color: var(--text-muted); }
.user-pill .btn { margin-left: 6px; border-radius: 99px; }

.dash-hello { margin-bottom: 26px; }
.dash-hello h1 { font-family: var(--font-display); font-weight: 800; font-size: 2.2rem; letter-spacing: -.035em; line-height: 1.1; }
.dash-hello p { color: var(--text-muted); max-width: 46em; }

/* Cards */
.card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 26px 26px 22px;
  margin-bottom: 26px;
}
.card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.card-header h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.025em; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--vermilion); color: var(--paper);
  font-family: var(--font-jp); font-weight: 800; font-size: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--mustard);
}
#data-section .step-badge { background: var(--teal-deep); }
#send-section .step-badge { background: var(--mustard); color: var(--ink); box-shadow: 2px 2px 0 var(--vermilion); }
#manage-section .step-badge { background: var(--ink); color: var(--mustard); box-shadow: 2px 2px 0 var(--teal); }

/* Forms */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-weight: 700; font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: .07em;
}
.field label small { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .8; }
.help-text { display: block; font-size: .8rem; color: var(--text-muted); margin-top: 7px; line-height: 1.45; }

input[type="text"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 11px 13px;
  background: var(--white);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--ink); box-shadow: var(--shadow-hard-sm); }
input[type="number"] { width: auto; min-width: 90px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--vermilion); width: 16px; height: 16px; }
textarea { resize: vertical; }
.input-sm { padding: 6px 10px !important; font-size: .85rem !important; max-width: 220px; }

.inline-row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px; }
.select-wrap::after {
  content: ''; position: absolute; right: 14px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Rich editor */
.rich-editor {
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t);
}
.rich-editor:focus-within { border-color: var(--ink); box-shadow: var(--shadow-hard-sm); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-bottom: 2px solid var(--line); background: var(--paper-2); }
.toolbar-btn { width: auto; min-width: 34px; height: 32px; padding: 0 10px; font-size: .82rem; color: var(--ink); background: var(--white); }
.rich-input { min-height: 150px; padding: 13px 15px; color: #1a1a1a; font-size: .95rem; line-height: 1.6; outline: none; background: var(--white); }
.rich-input:empty::before { content: attr(data-placeholder); color: var(--text-dim); }
.rich-input a { color: var(--teal-deep); }
.rich-input ul, .rich-input ol { padding-left: 20px; }
.rich-input p, .rich-input ul, .rich-input ol { margin: 0 0 10px; }
.rich-input p:last-child, .rich-input ul:last-child, .rich-input ol:last-child { margin-bottom: 0; }

/* File drop */
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 30px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(137 177 181 / .12) 10px 20px);
  cursor: pointer; text-align: center;
  transition: border-color var(--t), background-color var(--t);
}
.file-drop:hover, .file-drop.dragover { border-color: var(--vermilion); background-color: rgba(242 204 91 / .25); }
.file-drop svg { width: 32px; height: 32px; color: var(--vermilion); }
.file-drop span { font-size: .9rem; color: var(--text-muted); }
.file-drop input[type="file"] { display: none; }
.field > label.file-drop { display: flex; margin-bottom: 0; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .9rem; color: var(--text-muted); }

/* Variable chips */
.detected-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.chip-label { font-size: .8rem; color: var(--text-muted); margin-right: 4px; font-weight: 600; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  font-size: .8rem; font-weight: 700;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  border-radius: 99px;
  background: var(--mustard);
  color: var(--ink);
  border: 2px solid var(--ink);
  cursor: pointer; user-select: none;
  transition: transform var(--t), box-shadow var(--t);
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }

.email-var { color: var(--vermilion-deep); font-weight: 700; display: inline-block; padding: 0 3px; border-radius: 4px; background: rgba(242 204 91 / .45); }

/* Layout helpers */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.two-col.align-start { align-items: start; }
.two-col-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scroll-col { max-height: 70vh; overflow-y: auto; padding-right: 14px; }
.sticky-col { position: sticky; top: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.muted { opacity: .6; }
.center { text-align: center; padding: 1rem; }

/* Preview */
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.preview-toolbar h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.preview-nav { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--text-muted); font-weight: 600; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.icon-btn:hover:not(:disabled) { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn-bare { border: none; background: transparent; width: 24px; height: 24px; color: var(--text-muted); }
.icon-btn-bare:hover:not(:disabled) { box-shadow: none; color: var(--vermilion); }
.icon-btn-bare svg { width: 14px; height: 14px; }

.preview-pane {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 20px 18px;
  min-height: 280px;
  overflow: auto;
  font-size: .92rem;
  line-height: 1.65;
  color: #1a1a1a;
  box-shadow: 6px 6px 0 var(--teal), 6px 6px 0 2px var(--ink);
}
.preview-pane .empty-state { color: var(--text-dim); text-align: center; margin-top: 100px; }
.preview-pane .preview-subject { font-weight: 700; color: #000; margin-bottom: 10px; font-size: .98rem; }
.preview-pane .preview-cc { font-weight: 500; color: #555; margin-bottom: 12px; font-size: .9rem; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.preview-pane .preview-body { color: #1a1a1a; }
.preview-pane .preview-body ul, .preview-pane .preview-body ol { padding-left: 20px; }
.preview-pane .preview-body a { color: var(--teal-deep); }

/* Send */
.send-bar { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-end; margin-bottom: 18px; }
.send-timing { flex: 1; min-width: 240px; margin-bottom: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.radio-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--line-strong); border-radius: 99px;
  background: var(--white);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.radio-pill:has(input:checked) { border-color: var(--ink); background: var(--mustard); }
#schedule-time { max-width: 320px; }
.tz-settings { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--line); }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: .92rem; }
.check-row.small { font-size: .84rem; font-weight: 500; }
.tz-local-options { flex-direction: column; gap: 10px; margin: 10px 0 0 24px; }

.progress-track { width: 100%; height: 14px; border-radius: 99px; background: var(--white); border: 2px solid var(--ink); overflow: hidden; margin-bottom: 8px; }
.progress-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(-45deg, var(--vermilion) 0 10px, var(--vermilion-deep) 10px 20px);
  transition: width .4s ease;
}
.progress-text { font-size: .86rem; color: var(--text-muted); font-weight: 600; }

#results-area h3 { font-family: var(--font-display); font-weight: 800; margin-top: 8px; }

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 12px; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--white); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table-wrap thead { background: var(--ink); }
.table-wrap th, .table-wrap td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap th { font-weight: 700; color: var(--paper); text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; }
.table-wrap tbody tr:nth-child(even) { background: rgba(237 224 194 / .4); }
.table-wrap tbody tr:hover { background: rgba(242 204 91 / .25); }
.table-wrap td { color: var(--ink); }
.table-empty { text-align: center; opacity: .55; }

.plain-table { width: 100%; border-collapse: collapse; font-size: .9rem; text-align: left; }
.plain-table th { padding: 10px; border-bottom: 2px solid var(--ink); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.plain-table td { padding: 10px; border-bottom: 1px solid var(--line); }

/* Status labels (classes built as status-${status} in script.js) */
[class^="status-"] { font-weight: 700; }
.status-sent, .status-completed, .status-followed_up { color: var(--success); }
.status-error, .status-failed { color: var(--danger); }
.status-skipped, .status-skipped_replied, .status-pending { color: var(--warn); }
.status-paused { color: var(--teal-deep); }
.status-cancelled { color: var(--text-dim); text-decoration: line-through; }
#campaigns-tbody [class^="status-"] {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  border: 2px solid currentColor; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
}

/* Recipient rows in the edit modal */
.edit-recip-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--t);
}
.edit-recip-item:hover { border-color: var(--ink); }
.edit-recip-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.edit-recip-email { font-weight: 700; font-size: .9rem; }
.edit-recip-meta { font-size: .78rem; color: var(--text-muted); }
.edit-recip-meta span[style] { background: var(--paper-2) !important; }
.edit-recip-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn-control {
  padding: 4px 10px;
  font-size: .78rem; font-weight: 700;
  border-radius: 6px;
  border: 2px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: all var(--t);
}
.btn-control:hover:not(:disabled) { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.btn-control-pause:hover:not(:disabled) { background: var(--teal); }
.btn-control-resume:hover:not(:disabled) { background: #bfe0c9; }
.btn-control-cancel:hover:not(:disabled) { background: var(--vermilion); color: var(--white); }
.btn-control:disabled { opacity: .3; cursor: not-allowed; }

/* Follow-up planner */
.followup-config { margin-top: 10px; padding: 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); background: rgba(137 177 181 / .12); }
.followup-list { display: grid; gap: 12px; margin-top: 10px; }
.followup-item { border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 14px; background: var(--white); box-shadow: var(--shadow-hard-sm); }
.followup-editor-wrap { margin-top: 4px; }
.followup-editor-wrap .rich-input { min-height: 120px; }
.followup-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.followup-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .84rem; font-weight: 600; }
.followup-row input[type="number"] { width: 74px; min-width: 0; }
.followup-help { margin-top: 8px; color: var(--text-muted); font-size: .84rem; }

/* Modals */
.modal {
  position: fixed; inset: 0;
  background: rgba(36 22 15 / .55);
  z-index: 9999;
  overflow-y: auto;
  padding: 6vh 16px;
}
.modal-content {
  margin: 0 auto;
  padding: 30px;
  animation: modalIn .28s var(--ease);
  box-shadow: 10px 10px 0 var(--ink);
}
.modal-content h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.025em; margin-bottom: 14px; padding-right: 40px; }
.modal-content h4 { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1200px; }
.modal-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; font-size: 1.3rem; line-height: 1; }
.modal-sub { font-size: .9rem; color: var(--text-muted); margin: -6px 0 16px; }
.modal-section { border-top: 2px solid var(--line); padding-top: 18px; margin-top: 18px; }
.modal-section.dashed { border-top-style: dashed; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.modal-actions.spread { justify-content: space-between; }
.modal-actions .modal-actions { margin-top: 0; }
.status-line { font-size: .9rem; color: var(--text-muted); margin-right: auto; }
.list-box { max-height: 220px; overflow-y: auto; margin-bottom: 18px; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: var(--paper); }
.list-box.tall { max-height: 320px; }
.recip-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 0; }
.plain-list { list-style: none; }
.plain-list.gap { display: flex; flex-direction: column; gap: 8px; }
@keyframes modalIn {
  from { opacity: 0; transform: translate(0, 18px) rotate(-.6deg); }
  to   { opacity: 1; transform: none; }
}

/* Checkout */
.checkout-card { max-width: 820px; padding: 0; overflow: hidden; }
.checkout-grid { display: grid; grid-template-columns: 240px 1fr; }
.checkout-art { border-right: 2px solid var(--ink); min-height: 100%; }
.checkout-kanji {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  writing-mode: vertical-rl;
  font-family: var(--font-jp); font-weight: 800; font-size: 4.4rem;
  color: var(--mustard);
  text-shadow: 4px 4px 0 var(--maroon);
}
.checkout-body { padding: 30px 32px 28px; }
.checkout-body h3 { margin: 6px 0 14px; font-size: 2rem; }
.plan-switch { display: flex; gap: 8px; }
.plan-switch button {
  flex: 1; padding: 10px; font: inherit; font-weight: 800; cursor: pointer;
  border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--white); color: var(--ink);
  transition: all var(--t);
}
.plan-switch button[aria-checked="true"] { border-color: var(--ink); background: var(--mustard); box-shadow: var(--shadow-hard-sm); }
.checkout-body .plan-features { margin-bottom: 18px; }
.checkout-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; margin-bottom: 16px; border-top: 2px dashed var(--line-strong); }
.checkout-total span { font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
.checkout-total strong { font-family: var(--font-display); font-weight: 800; font-size: 2rem; letter-spacing: -.03em; }
.checkout-note { margin-top: 12px; font-size: .82rem; color: var(--text-dim); text-align: center; }

/* ── Responsive ── */
@media (max-width: 1000px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-grid { grid-template-columns: 1fr; max-width: 520px; }
  .plan-featured { transform: none; }
}
@media (max-width: 860px) {
  .site-links { display: none; }
  .hero { grid-template-columns: 1fr; gap: 44px; padding-top: 32px; }
  .hero-art { max-width: 340px; }
  .steps { grid-template-columns: 1fr; }
  .steps li + li { padding-left: 0; border-left: none; border-top: 2px dashed var(--line-strong); }
  .two-col { grid-template-columns: 1fr; }
  .checkout-grid { grid-template-columns: 1fr; }
  .checkout-art { min-height: 120px; border-right: none; border-bottom: 2px solid var(--ink); }
  .checkout-kanji { writing-mode: horizontal-tb; font-size: 3rem; }
  .closer-inner { padding: 56px 28px 56px 60px; }
}
@media (max-width: 560px) {
  .site-nav { padding: 12px 16px; }
  .site-actions .btn-ghost { display: none; }
  .hero, .section { padding-left: 16px; padding-right: 16px; }
  .section { padding-top: 76px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature { min-height: 0; }
  .closer { margin: 80px 16px 0; }
  .site-footer { padding-left: 16px; padding-right: 16px; }
  #app { padding: 12px 16px 48px; }
  .card { padding: 20px 16px 18px; }
  .modal-content { padding: 22px 18px; }
  .checkout-card { padding: 0; }
  .checkout-body { padding: 22px 18px; }
  .user-pill .user-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
