:root {
  color-scheme: dark;
  --ink: #f0f8f7;
  --muted: #8da7a4;
  --line: rgba(111, 204, 194, .18);
  --line-strong: rgba(109, 231, 215, .52);
  --panel: rgba(8, 23, 27, .86);
  --panel-soft: rgba(12, 33, 37, .65);
  --cyan: #6de7d7;
  --blue: #83a8ff;
  --red: #ff8d84;
  --green: #a9f57e;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(48, 144, 152, .15), transparent 28%),
    linear-gradient(rgba(2, 12, 15, .94), rgba(4, 15, 18, .98)),
    #041014;
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(89, 184, 175, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(89, 184, 175, .035) 1px, transparent 1px);
  background-size: 54px 54px;
  content: "";
  pointer-events: none;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }
.message-shell { width: min(1260px, calc(100% - 44px)); margin: 0 auto; padding-bottom: 80px; }
.message-nav { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(109,231,215,.34); border-radius: 11px; background: rgba(109,231,215,.08); color: var(--cyan); font: 700 10px/1 ui-monospace, monospace; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.back-link { color: var(--muted); font-size: 11px; }
.back-link:hover, .back-link:focus-visible { color: var(--cyan); outline: none; }
.eyebrow { margin: 0 0 9px; color: var(--cyan); font: 700 9px/1.3 ui-monospace, monospace; letter-spacing: .2em; }
.access-card { margin: 60px 0; padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); }
.access-card h1 { margin: 0 0 11px; font: 400 clamp(34px, 5vw, 58px)/1.05 Georgia, serif; }
.access-card p:last-child { margin-bottom: 0; color: var(--muted); }
.access-card[data-state="error"] { border-color: rgba(255,141,132,.44); }
.message-hero { display: grid; grid-template-columns: 1fr minmax(280px, .65fr); align-items: end; gap: 48px; padding: 72px 0 58px; }
.message-hero h1 { margin: 0; font: 400 clamp(52px, 8vw, 92px)/.9 Georgia, serif; letter-spacing: -.055em; }
.message-hero h1 em { color: var(--cyan); font-weight: 400; }
.message-hero > p { max-width: 490px; margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.message-workspace { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); align-items: start; gap: 22px; }
.composer, .message-history { padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); }
.message-history { position: sticky; top: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.section-heading h2 { margin: 0; font: 400 33px/1 Georgia, serif; }
.quiet-button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; font-size: 10px; }
.quiet-button:hover, .quiet-button:focus-visible { border-color: var(--line-strong); color: var(--cyan); outline: none; }
.field { display: grid; gap: 8px; margin-bottom: 17px; color: var(--muted); font-size: 10px; }
.field input, .field textarea, .field select, .picker-heading input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; outline: none; background: rgba(2,13,16,.76); color: var(--ink); padding: 12px 13px;
}
.field textarea { min-height: 210px; resize: vertical; line-height: 1.75; }
.field input:focus, .field textarea:focus, .field select:focus, .picker-heading input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(109,231,215,.08); }
.field > small { justify-self: end; color: #607c79; }
.field > small b { color: var(--muted); font-weight: 500; }
.form-split { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.audience-picker { margin: 1px 0 18px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(109,231,215,.035); }
.picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.picker-heading > div { display: grid; gap: 4px; font-size: 11px; }
.picker-heading small { color: var(--cyan); font-size: 9px; }
.picker-heading input { max-width: 220px; padding: 9px 11px; font-size: 10px; }
.user-list { display: grid; max-height: 245px; gap: 7px; overflow-y: auto; scrollbar-color: rgba(109,231,215,.35) transparent; }
.user-option { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: center; gap: 9px; padding: 10px; border: 1px solid rgba(111,204,194,.12); border-radius: 11px; background: rgba(255,255,255,.018); cursor: pointer; }
.user-option input { position: absolute; opacity: 0; pointer-events: none; }
.user-option > span { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid var(--line); border-radius: 5px; }
.user-option input:checked + span { border-color: var(--cyan); background: rgba(109,231,215,.18); }
.user-option input:checked + span::after { width: 7px; height: 4px; border-bottom: 2px solid var(--cyan); border-left: 2px solid var(--cyan); content: ""; transform: translateY(-1px) rotate(-45deg); }
.user-option input:focus-visible + span { box-shadow: 0 0 0 3px rgba(109,231,215,.12); }
.user-option > b { display: grid; min-width: 0; gap: 3px; font-size: 10px; font-weight: 550; }
.user-option small { overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.email-option { display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: center; gap: 3px 10px; margin: 2px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(131,168,255,.045); cursor: pointer; }
.email-option input { position: absolute; opacity: 0; pointer-events: none; }
.email-option > span { grid-row: 1 / span 2; display: grid; width: 19px; height: 19px; place-items: center; border: 1px solid var(--line); border-radius: 6px; }
.email-option input:checked + span { border-color: var(--blue); background: rgba(131,168,255,.2); }
.email-option input:checked + span::after { width: 8px; height: 4px; border-bottom: 2px solid #c5d4ff; border-left: 2px solid #c5d4ff; content: ""; transform: translateY(-1px) rotate(-45deg); }
.email-option b { font-size: 11px; }
.email-option small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.email-option:has(input:disabled) { cursor: not-allowed; opacity: .5; }
.form-status { min-height: 17px; margin: 0 0 12px; color: var(--cyan); font-size: 10px; line-height: 1.6; }
.form-status.error { color: var(--red); }
.primary-button { width: 100%; min-height: 45px; border: 0; border-radius: 999px; background: var(--cyan); color: #05201c; cursor: pointer; font-weight: 750; }
.primary-button:disabled { cursor: wait; opacity: .5; }
.record-count { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; }
.history-list { display: grid; max-height: 760px; gap: 9px; overflow-y: auto; padding-right: 3px; scrollbar-color: rgba(109,231,215,.35) transparent; }
.message-record { padding: 16px; border: 1px solid rgba(111,204,194,.13); border-radius: 15px; background: var(--panel-soft); }
.record-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.record-state { padding: 4px 7px; border: 1px solid rgba(141,167,164,.22); border-radius: 999px; color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.record-state.published { border-color: rgba(169,245,126,.25); color: var(--green); }
.record-time { color: #637d7a; font-size: 9px; }
.message-record h3 { margin: 13px 0 7px; font-size: 15px; }
.message-record > p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 13px; color: #79938f; font-size: 9px; }
.record-actions { display: flex; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid rgba(111,204,194,.1); }
.record-actions button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; }
.record-actions button:hover, .record-actions button:focus-visible { border-color: var(--line-strong); color: var(--ink); outline: none; }
.record-actions button:last-child:hover { border-color: rgba(255,141,132,.4); color: var(--red); }
.empty-state { margin: 0; padding: 36px 12px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.7; }

@media (max-width: 900px) {
  .message-hero, .message-workspace { grid-template-columns: 1fr; }
  .message-history { position: static; }
  .message-hero { gap: 24px; }
}
@media (max-width: 600px) {
  .message-shell { width: min(100% - 22px, 1260px); }
  .message-nav { min-height: 64px; }
  .brand > span:last-child { display: none; }
  .message-hero { padding: 50px 0 36px; }
  .composer, .message-history { padding: 21px 16px; border-radius: 19px; }
  .form-split { grid-template-columns: 1fr; gap: 0; }
  .picker-heading { align-items: stretch; flex-direction: column; }
  .picker-heading input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
