:root {
  --paper: #f2ecdf;
  --paper-deep: #e8dfd0;
  --surface: #fbf8f1;
  --surface-warm: #f7f1e7;
  --ink: #282631;
  --muted: #6d6873;
  --soft-ink: #948d98;
  --line: #d8cfbf;
  --line-strong: #c8bdad;
  --deep: #292533;
  --deep-soft: #383242;
  --accent: #ef7355;
  --accent-dark: #b74835;
  --mint: #72aa8c;
  --danger: #b94f48;
  --radius: 18px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--paper);
}

button, input, textarea, select { font: inherit; }
button, select, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.noise { display: none; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.view-shell { position: relative; z-index: 1; width: min(1200px, 100%); margin: 0 auto; padding: 22px 34px; }
.auth-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); gap: clamp(44px, 9vw, 128px); min-height: 100dvh; align-items: center; padding-top: 60px; padding-bottom: 60px; }
.dashboard-view { min-height: 100dvh; padding-top: 22px; padding-bottom: 28px; }

.brand-lockup { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-decoration: none; }
.brand-mark { position: relative; display: inline-block; width: 33px; height: 33px; flex: 0 0 auto; border-radius: 10px; background: var(--deep); }
.brand-mark::before { position: absolute; top: -5px; left: 15px; width: 3px; height: 6px; border-radius: 3px; background: var(--accent); content: ""; }
.brand-mark::after { position: absolute; top: -8px; left: 13px; width: 7px; height: 7px; border: 2px solid var(--accent); border-radius: 50%; content: ""; }
.brand-mark i { position: absolute; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--paper); }
.brand-mark i:first-child { left: 9px; }
.brand-mark i:nth-child(2) { right: 9px; }
.brand-mark b { position: absolute; bottom: 8px; left: 11px; width: 11px; height: 3px; border-radius: 3px; background: var(--accent); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.auth-intro { max-width: 590px; }
.auth-intro h1, .dashboard-hero h1 { margin: 38px 0 0; color: var(--ink); font-size: 4.25rem; font-weight: 730; letter-spacing: -.055em; line-height: .98; }
.auth-intro h1 span, .dashboard-hero h1 span { color: var(--accent-dark); }
.intro-copy, .hero-note { max-width: 34rem; margin: 24px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.signal-card { display: grid; max-width: 390px; margin-top: 35px; border-top: 1px solid var(--line-strong); }
.signal-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; min-height: 43px; align-items: center; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.signal-row strong { color: var(--soft-ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.signal-dot, .state-dot, .status-light { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.signal-dot.muted { background: var(--line-strong); }

.auth-panel { width: 100%; padding: 25px; box-shadow: 16px 18px 0 var(--paper-deep); }
.panel-topline, .status-label, .counter, .zone-kind, .hero-aside-label, .micro-label, .footer-bar { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; letter-spacing: .12em; }
.panel-topline { display: flex; justify-content: space-between; color: var(--soft-ink); font-size: 9px; }
.auth-heading { margin: 55px 0 25px; }
.auth-heading h2 { margin: 0; color: var(--ink); font-size: 1.75rem; letter-spacing: -.035em; line-height: 1.1; }
.auth-heading p:last-child { max-width: 300px; margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.form-stack, .compose-card { display: grid; gap: 17px; }
.field { display: grid; gap: 8px; }
.field > span, .field-label { color: var(--muted); font-size: 11px; font-weight: 720; letter-spacing: .02em; }
.field > span small { color: var(--soft-ink); font-size: 10px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input, .field select { min-height: 48px; padding: 0 14px; }
.field textarea { min-height: 132px; padding: 13px 14px; resize: vertical; line-height: 1.6; }
.field-message textarea { min-height: 154px; }
.field input::placeholder, .field textarea::placeholder { color: #a29ba3; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: #fffdf9; box-shadow: 0 0 0 3px rgba(239, 115, 85, .16); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 21px, calc(100% - 12px) 21px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; }
.button { display: inline-flex; min-height: 45px; align-items: center; justify-content: center; gap: 11px; border: 1px solid transparent; border-radius: 999px; padding: 0 17px; font-size: 12px; font-weight: 800; letter-spacing: .01em; transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease; }
.button:active { transform: translateY(1px) scale(.985); }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button:focus-visible, .text-button:focus-visible, summary:focus-visible, .upload-control:focus-within { outline: 3px solid rgba(239, 115, 85, .27); outline-offset: 3px; }
.button-primary { background: var(--accent); color: #291913; }
.button-primary:hover { background: #f58868; }
.button-wide { width: 100%; margin-top: 3px; }
.button-quiet { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.button-quiet:hover { border-color: var(--accent); color: var(--accent-dark); background: #fffaf3; }
.button-danger { border-color: var(--danger); background: var(--danger); color: #fff8f1; }
.button-danger:hover { border-color: #a63e39; background: #a63e39; }
.form-note { margin: 18px 0 0; color: var(--soft-ink); font-size: 11px; line-height: 1.6; }

.topbar { display: flex; min-height: 52px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.status-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.status-light { width: 7px; height: 7px; background: var(--line-strong); }
.status-label.online { color: var(--mint); }
.status-label.online .status-light { background: var(--mint); }
.status-label.offline { color: var(--danger); }
.status-label.offline .status-light { background: var(--danger); }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--ink); }

.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 280px); gap: 28px; align-items: end; padding: 70px 0 42px; }
.hero-identity { display: flex; gap: 28px; align-items: flex-end; }
.hero-copy { min-width: 0; }
.dashboard-hero h1 { margin: 0; font-size: 4.1rem; }
.hero-note { margin: 19px 0 0; font-size: 14px; }
.hero-device-mark { position: relative; display: grid; width: 112px; height: 112px; flex: 0 0 auto; place-items: center; border: 1px solid var(--deep-soft); border-radius: 32px; background: var(--deep); box-shadow: 9px 10px 0 rgba(41, 37, 51, .12); }
.hero-device-mark::before, .hero-device-mark::after { position: absolute; top: 45px; width: 6px; height: 24px; border-radius: 3px; background: var(--deep-soft); content: ""; }
.hero-device-mark::before { left: -7px; }
.hero-device-mark::after { right: -7px; }
.hero-antenna { position: absolute; top: 13px; left: 53px; width: 5px; height: 14px; border-radius: 3px; background: var(--accent); }
.hero-antenna::after { position: absolute; top: -7px; left: -3px; width: 11px; height: 11px; border: 2px solid var(--accent); border-radius: 50%; content: ""; }
.hero-eye { position: absolute; top: 45px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); }
.hero-eye.left { left: 29px; }
.hero-eye.right { right: 29px; }
.hero-mouth { position: absolute; bottom: 27px; left: 40px; width: 33px; height: 6px; border-radius: 6px; background: var(--accent); }
.hero-aside { max-width: 260px; justify-self: end; padding-bottom: 5px; color: var(--muted); }
.hero-aside-label { display: block; color: var(--accent-dark); font-size: 9px; font-weight: 700; }
.hero-aside p { margin: 12px 0 0; font-size: 13px; line-height: 1.65; }

.device-strip { display: grid; grid-template-columns: auto minmax(180px, 1fr) minmax(220px, auto); gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--deep); color: #faf7ef; }
.device-orb { position: relative; display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid #635a6d; border-radius: 14px; background: var(--deep-soft); }
.device-orb::before, .device-orb::after { position: absolute; top: 20px; width: 4px; height: 10px; border-radius: 2px; background: #62596d; content: ""; }
.device-orb::before { left: -4px; }
.device-orb::after { right: -4px; }
.device-orb .signal-dot { width: 11px; height: 11px; background: var(--accent); }
.device-meta { min-width: 0; display: grid; gap: 4px; }
.device-meta .field-label { color: #afa6b5; font-size: 10px; }
.device-meta select { width: 100%; min-height: 25px; padding: 0 24px 0 0; border: 0; outline: 0; appearance: none; background-color: transparent; background-image: linear-gradient(45deg, transparent 50%, #b9b0bd 50%), linear-gradient(135deg, #b9b0bd 50%, transparent 50%); background-position: calc(100% - 17px) 10px, calc(100% - 12px) 10px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; color: #fffaf1; font-size: 16px; font-weight: 720; text-overflow: ellipsis; }
.device-meta code { overflow: hidden; color: #afa6b5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; }
.device-state { display: grid; grid-template-columns: 10px auto minmax(110px, 1fr); gap: 8px; align-items: center; min-width: 220px; padding-left: 18px; border-left: 1px solid #514a5c; }
.state-dot { width: 7px; height: 7px; background: #81788a; }
.device-state strong { color: #eee7db; font-size: 12px; }
.device-state small { overflow: hidden; color: #afa6b5; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.device-strip.empty .device-orb .signal-dot { background: #81788a; }
.device-strip.online .state-dot { background: var(--mint); }
.device-strip.online .device-state strong { color: #9ad2b0; }
.device-strip.offline .state-dot { background: #e27668; }
.device-strip.offline .device-state strong { color: #f29b8e; }

.conversation-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-top: 26px; align-items: start; }
.conversation-zone { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.outbox-zone { border-color: rgba(239, 115, 85, .62); }
.inbox-zone { border-color: rgba(41, 37, 51, .42); }
.zone-header { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.zone-symbol { position: relative; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: var(--paper-deep); }
.zone-symbol::before, .zone-symbol::after { position: absolute; width: 4px; height: 12px; border-radius: 2px; background: var(--accent); content: ""; }
.zone-symbol::before { left: 10px; transform: rotate(-45deg); }
.zone-symbol::after { right: 10px; transform: rotate(45deg); }
.zone-symbol span { position: relative; display: block; width: 18px; height: 4px; border-radius: 4px; background: var(--accent); }
.send-symbol span::after { position: absolute; top: -5px; right: -3px; width: 12px; height: 12px; background: var(--accent); clip-path: polygon(0 0, 100% 50%, 0 100%, 0 69%, 57% 50%, 0 31%); content: ""; }
.receive-symbol { background: #e7e2ed; }
.receive-symbol::before, .receive-symbol::after { background: var(--deep); }
.receive-symbol span { background: var(--deep); }
.receive-symbol span::after { position: absolute; top: -5px; left: -3px; width: 12px; height: 12px; background: var(--deep); clip-path: polygon(100% 0, 0 50%, 100% 100%, 100% 69%, 43% 50%, 100% 31%); content: ""; }
.zone-header-copy h2 { margin: 0; color: var(--ink); font-size: 1.65rem; letter-spacing: -.04em; line-height: 1.12; }
.zone-header-copy p { max-width: 340px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.zone-kind { align-self: center; color: var(--soft-ink); font-size: 9px; font-weight: 700; white-space: nowrap; }

.compose-card { padding-top: 24px; }
.composer-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-warm); }
.composer-tab { display: grid; grid-template-columns: 34px 1fr; gap: 10px; min-width: 0; align-items: center; padding: 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease, transform .16s ease; }
.composer-tab:hover { color: var(--ink); background: #fffaf3; }
.composer-tab:active { transform: translateY(1px); }
.composer-tab:focus-visible { outline: 3px solid rgba(239, 115, 85, .27); outline-offset: 2px; }
.composer-tab.active { border-color: var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 rgba(41, 37, 51, .08); }
.composer-tab-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--paper-deep); color: var(--accent-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 800; }
.composer-tab span:last-child { display: grid; gap: 4px; min-width: 0; }
.composer-tab strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.composer-tab small { color: var(--soft-ink); font-size: 10px; line-height: 1.3; }
.compose-panel { display: grid; gap: 17px; padding-top: 22px; }
.compose-panel-heading { display: grid; gap: 7px; }
.compose-panel-heading h3 { margin: 0; color: var(--ink); font-size: 1.15rem; letter-spacing: -.025em; }
.compose-panel-heading p { max-width: 370px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.delivery-choice { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.delivery-choice legend { margin-bottom: 1px; color: var(--muted); font-size: 11px; font-weight: 720; }
.delivery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.delivery-card { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 9px; min-width: 0; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-warm); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.delivery-card:hover { border-color: var(--accent); background: #fffaf3; }
.delivery-card:has(input:checked) { border-color: var(--accent); background: #fffaf3; }
.delivery-card input { margin: 3px 0 0; accent-color: var(--accent); }
.delivery-card span { display: grid; gap: 5px; }
.delivery-card strong { color: var(--ink); font-size: 12px; }
.delivery-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.image-lab { display: grid; gap: 14px; margin-top: 2px; padding: 18px; border-radius: 14px; background: var(--deep); color: #f8f2e8; }
.image-lab-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.image-lab-heading h3, .photo-module-heading h3, .board-history-heading h3 { margin: 5px 0 0; color: inherit; font-size: 1.08rem; letter-spacing: -.025em; }
.image-lab-heading p { max-width: 340px; margin: 7px 0 0; color: #bdb4c0; font-size: 11px; line-height: 1.55; }
.micro-label { display: block; color: var(--accent); font-size: 9px; font-weight: 700; }
.image-lab .field > span { color: #cfc6d0; }
.image-lab .field textarea { min-height: 100px; border-color: #5a5262; background: #312c3a; color: #fffaf0; }
.image-lab .field textarea::placeholder { color: #978e9c; }
.image-lab .field textarea:focus { border-color: var(--accent); background: #393343; }
.image-lab-mark { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; border: 1px solid var(--accent); border-radius: 12px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 800; }
.image-lab-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.image-lab-footer > span { color: #a9a0ad; font-size: 10px; }
.image-lab-footer .button { border-color: #686071; color: #f6eee3; }
.image-lab-footer .button:hover { border-color: var(--accent); color: #fffaf0; background: var(--deep-soft); }
.image-library-disclosure { margin-top: 2px; border-top: 1px solid #5a5262; }
.image-library-disclosure summary { display: flex; min-height: 47px; align-items: center; justify-content: space-between; gap: 16px; list-style: none; cursor: pointer; color: #f8f2e8; font-size: 11px; font-weight: 760; }
.image-library-disclosure summary::-webkit-details-marker { display: none; }
.image-library-disclosure summary::after { width: 8px; height: 8px; flex: 0 0 auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); content: ""; transition: transform .18s ease; }
.image-library-disclosure[open] summary::after { transform: rotate(225deg) translate(-1px, -2px); }
.image-library-disclosure summary small { color: #a9a0ad; font-size: 10px; font-weight: 500; }
.image-library-disclosure summary strong { margin-left: auto; color: #bdb4c0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 600; }
.image-library-disclosure summary:hover { color: #fffaf0; }
.image-library-disclosure .history-content { padding: 0 0 2px; }
.image-library-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.image-library-item { display: grid; gap: 5px; min-width: 0; padding: 0; border: 0; background: transparent; color: #f8f2e8; text-align: left; cursor: pointer; }
.image-library-item img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--deep-soft); object-fit: cover; opacity: .88; transition: opacity .18s ease, outline-color .18s ease; }
.image-library-item:hover img { opacity: 1; }
.image-library-item.selected img { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
.image-library-item:focus-visible { outline: 3px solid rgba(239, 115, 85, .35); outline-offset: 3px; border-radius: 8px; }
.image-library-meta { display: grid; gap: 2px; min-width: 0; }
.image-library-meta strong { overflow: hidden; color: #f8f2e8; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.image-library-meta small { overflow: hidden; color: #a9a0ad; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.image-library-empty { grid-column: 1 / -1; margin: 0; padding: 10px 0 3px; color: #a9a0ad; font-size: 10px; line-height: 1.5; }
.attachment-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.upload-control { display: inline-flex; min-height: 42px; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font-size: 12px; }
.upload-control:hover { border-color: var(--accent); color: var(--accent-dark); background: #fffaf3; }
.upload-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-glyph { color: var(--accent-dark); font-size: 18px; font-weight: 300; line-height: 1; }
.upload-note { color: var(--soft-ink); font-size: 10px; }
.image-preview { display: grid; grid-template-columns: 64px 1fr auto; gap: 11px; align-items: center; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-warm); }
.image-preview img { width: 64px; height: 48px; border-radius: 7px; object-fit: cover; background: var(--paper-deep); }
.image-preview.generated { grid-template-columns: 126px 1fr auto; }
.image-preview.generated img { width: 126px; height: 94px; border-radius: 9px; }
.image-preview div { display: grid; gap: 4px; min-width: 0; }
.image-preview strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.image-preview small { color: var(--muted); font-size: 10px; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.icon-button:hover { background: var(--paper-deep); color: var(--ink); }

.advanced-controls { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-controls summary, .history-disclosure summary { display: flex; min-height: 53px; align-items: center; justify-content: space-between; gap: 16px; list-style: none; cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 760; }
.advanced-controls summary::-webkit-details-marker, .history-disclosure summary::-webkit-details-marker { display: none; }
.advanced-controls summary::after, .history-disclosure summary::after { width: 8px; height: 8px; flex: 0 0 auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); content: ""; transition: transform .18s ease; }
.advanced-controls[open] summary::after, .history-disclosure[open] summary::after { transform: rotate(225deg) translate(-1px, -2px); }
.advanced-controls summary small, .history-disclosure summary small { margin-left: auto; color: var(--soft-ink); font-size: 10px; font-weight: 500; }
.advanced-controls-body { display: grid; gap: 15px; padding: 3px 0 19px; }
.audio-mode-note { margin: -6px 0 0; color: var(--soft-ink); font-size: 10px; line-height: 1.55; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compose-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 2px; }
.counter { color: var(--soft-ink); font-size: 9px; letter-spacing: .08em; }
.compose-footer .button { min-width: 150px; }

.history-disclosure { border-top: 1px solid var(--line); }
.sent-history { margin-top: 22px; }
.history-disclosure summary:hover { color: var(--accent-dark); }
.history-content { padding: 0 0 16px; }
.history-disclosure[open] .history-content { animation: reveal-content .2s ease-out both; }
@keyframes reveal-content { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.activity-list { display: grid; gap: 1px; min-height: 90px; border-top: 1px solid var(--line); }
.empty-state { display: grid; align-content: center; justify-items: start; min-height: 120px; color: var(--muted); }
.empty-line { display: block; width: 35px; height: 1px; margin-bottom: 15px; background: var(--accent); }
.empty-state p { max-width: 230px; margin: 0; font-size: 12px; line-height: 1.6; }
.activity-item { display: grid; grid-template-columns: 9px 1fr auto; gap: 11px; align-items: start; padding: 15px 0; border-bottom: 1px solid var(--line); }
.activity-item .signal-dot { width: 6px; height: 6px; margin-top: 5px; }
.activity-item strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item p { overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.activity-status { display: block; margin-top: 7px; color: var(--soft-ink); font-size: 10px; line-height: 1.35; }
.activity-item.delivery-waiting .activity-status { color: #bd7b46; }
.activity-item.delivery-queued .activity-status { color: #887a69; }
.activity-item.delivery-delivered .activity-status { color: var(--mint); }
.activity-item.delivery-timeout .activity-status { color: var(--danger); }
.activity-item.delivery-delivered .signal-dot { background: var(--mint); }
.activity-item.delivery-timeout .signal-dot { background: var(--danger); }
.activity-item time { color: var(--soft-ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; white-space: nowrap; }

.message-board { margin-top: 22px; }
.message-board-frame { position: relative; overflow: hidden; padding: 18px; border: 1px solid #a87850; border-radius: 18px; background: #c18c5d; box-shadow: 8px 9px 0 rgba(41, 37, 51, .12); }
.message-board-frame::before, .message-board-frame::after { position: absolute; right: -28px; left: -28px; height: 1px; background: rgba(91, 56, 35, .24); content: ""; }
.message-board-frame::before { top: 10px; }
.message-board-frame::after { bottom: 10px; }
.message-board-heading { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 0 2px 14px; }
.message-board-heading h2 { margin: 5px 0 0; color: #2b2523; font-size: 1.3rem; letter-spacing: -.035em; }
.message-board-heading p { margin: 6px 0 0; color: rgba(43, 37, 35, .68); font-size: 11px; line-height: 1.5; }
.message-board-count { display: grid; gap: 4px; justify-items: end; color: #3b2c26; }
.board-count-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .12em; }
.message-board-count strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.blackboard-surface { position: relative; overflow: hidden; min-height: 218px; padding: 28px 20px 38px; border: 8px solid #704e38; border-radius: 10px; background-color: #24443c; background-image: radial-gradient(circle at 16% 24%, rgba(220, 235, 207, .09) 0 1px, transparent 1.5px), radial-gradient(circle at 73% 68%, rgba(220, 235, 207, .06) 0 1px, transparent 1.5px), linear-gradient(112deg, rgba(255,255,255,.035), transparent 40%, rgba(0,0,0,.11)); background-size: 39px 31px, 53px 47px, 100% 100%; box-shadow: inset 0 0 0 1px rgba(213, 226, 199, .15), inset 0 12px 22px rgba(0, 0, 0, .16), inset 0 -9px 0 rgba(0, 0, 0, .12); }
.blackboard-surface::before { position: absolute; right: 12%; bottom: 25%; width: 92px; height: 42px; border-top: 1px solid rgba(222, 234, 211, .18); border-bottom: 1px solid rgba(222, 234, 211, .12); transform: rotate(-5deg); content: ""; opacity: .6; }
.blackboard-screws { position: absolute; top: -2px; right: 12px; left: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.blackboard-screws i { display: block; width: 10px; height: 10px; border: 2px solid #bb8a62; border-radius: 50%; background: #6b4b36; box-shadow: inset 1px 1px 0 rgba(255,255,255,.18); }
.message-board-list { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 15px; border: 0; }
.message-board-item { position: relative; display: grid; gap: 9px; min-height: 144px; padding: 24px 16px 15px; border: 0; border-radius: 2px 3px 4px 2px; background: #f5d78d; box-shadow: 4px 7px 0 rgba(9, 28, 24, .24), 0 1px 0 rgba(255,255,255,.25) inset; color: #40352b; transform: rotate(-1.1deg); transition: transform .2s ease, box-shadow .2s ease; }
.message-board-item:nth-child(2n) { background: #f0cfa0; transform: rotate(1.2deg); }
.message-board-item:nth-child(3n) { background: #e9d99d; transform: rotate(-.45deg); }
.message-board-item:hover { z-index: 2; box-shadow: 5px 9px 0 rgba(9, 28, 24, .28), 0 1px 0 rgba(255,255,255,.25) inset; transform: translateY(-3px) rotate(0deg); }
.message-board-item::before { position: absolute; top: 8px; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 1px 2px 0 rgba(62, 35, 28, .25); content: ""; transform: translateX(-50%); }
.message-board-item::after { position: absolute; top: 13px; left: calc(50% - 4px); width: 8px; height: 1px; background: rgba(255, 246, 217, .62); content: ""; transform: rotate(-25deg); }
.message-note-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #8a5b3c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .06em; }
.message-note-meta time { color: rgba(64, 53, 43, .58); white-space: nowrap; }
.message-note-actions { display: inline-flex; align-items: center; gap: 7px; }
.message-note-delete { display: inline-grid; width: 24px; height: 24px; place-items: center; padding: 0; border: 1px solid rgba(158, 90, 65, .26); border-radius: 50%; background: rgba(255, 245, 211, .3); color: #9e5a41; font-family: inherit; font-size: 16px; font-weight: 500; line-height: 1; }
.message-note-delete:hover { border-color: var(--danger); background: rgba(255, 243, 239, .76); color: var(--danger); }
.message-note-delete:focus-visible { outline: 3px solid rgba(185, 79, 72, .25); outline-offset: 2px; }
.message-note-title { overflow: hidden; color: #40352b; font-size: 12px; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.message-note-content { margin: 0; color: #544434; font-size: 13px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-board-empty { display: grid; min-height: 152px; place-items: center; margin: 0; padding: 25px; border: 1px dashed rgba(223, 236, 215, .38); color: rgba(238, 244, 226, .82); font-size: 11px; line-height: 1.6; text-align: center; }
.blackboard-signature { position: absolute; right: 20px; bottom: 11px; color: rgba(224, 236, 214, .42); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .12em; }
.inbox-stack { display: grid; gap: 20px; padding-top: 24px; }
.photo-module { display: grid; gap: 14px; }
.photo-module-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.photo-module-heading h3 { color: var(--ink); }
.photo-module-heading p { max-width: 280px; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.photo-module-heading .button { flex: 0 0 auto; }
.photo-state { color: var(--muted); font-size: 11px; line-height: 1.5; }
.photo-state[data-state="waiting"] { color: #bd7b46; }
.photo-state[data-state="completed"] { color: var(--mint); }
.photo-state[data-state="failed"] { color: var(--danger); }
.remote-photo-preview { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; align-items: end; }
.remote-photo-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; background: var(--deep); object-fit: contain; }
.remote-photo-meta { display: grid; gap: 5px; padding-bottom: 2px; color: var(--ink); font-size: 11px; }
.remote-photo-meta small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.photo-delete-button { display: inline-grid; width: 28px; height: 28px; place-items: center; justify-self: start; padding: 0; border: 1px solid rgba(185, 79, 72, .35); border-radius: 50%; background: transparent; color: var(--danger); font-size: 17px; font-weight: 500; line-height: 1; }
.photo-delete-button:hover { border-color: var(--danger); background: #fff3ef; }
.photo-delete-button:focus-visible, .message-note-delete:focus-visible { outline: 3px solid rgba(185, 79, 72, .25); outline-offset: 2px; }
.photo-history-block { border-bottom: 1px solid var(--line); }
.photo-history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photo-history-item { position: relative; display: grid; gap: 5px; min-width: 0; color: var(--muted); text-decoration: none; }
.photo-history-link { display: grid; gap: 5px; min-width: 0; color: var(--muted); text-decoration: none; }
.photo-history-link img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--deep); object-fit: cover; transition: transform .18s ease, opacity .18s ease; }
.photo-history-link:hover img { opacity: .84; transform: translateY(-2px); }
.photo-history-link span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.photo-history-delete { position: absolute; top: 5px; right: 5px; z-index: 1; width: 25px; height: 25px; border-color: rgba(255, 250, 240, .7); background: rgba(41, 37, 51, .72); color: #fffaf0; }
.photo-history-delete:hover { border-color: #fffaf0; background: var(--danger); color: #fffaf0; }
.photo-history-empty { margin: 0; color: var(--soft-ink); font-size: 10px; }
.capability-note { display: grid; grid-template-columns: 9px 1fr; gap: 11px; align-items: start; margin-top: 21px; padding-top: 16px; border-top: 1px solid var(--line); }
.capability-note .signal-dot { width: 6px; height: 6px; margin-top: 5px; }
.capability-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.footer-bar { display: flex; justify-content: space-between; gap: 12px; margin-top: 52px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--soft-ink); font-size: 8px; letter-spacing: .1em; }
.delete-dialog { width: min(410px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: 12px 16px 0 rgba(41, 37, 51, .16); color: var(--ink); }
.delete-dialog::backdrop { background: rgba(40, 37, 46, .48); backdrop-filter: blur(4px); }
.delete-dialog-card { display: grid; gap: 16px; padding: 25px; }
.delete-dialog-kicker { color: var(--danger); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.delete-dialog h2 { margin: 0; color: var(--ink); font-size: 1.55rem; letter-spacing: -.04em; line-height: 1.1; }
.delete-dialog-card > p { margin: -7px 0 1px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.delete-dialog-error { min-height: 16px; margin: -7px 0 0 !important; color: var(--danger) !important; font-size: 11px !important; }
.delete-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-top: 2px; }
.toast { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); left: 18px; z-index: 10; display: none; padding: 13px 15px; border: 1px solid var(--deep-soft); border-radius: 12px; background: var(--deep); box-shadow: 9px 10px 0 rgba(41, 37, 51, .12); color: #fffaf0; font-size: 12px; line-height: 1.45; }
.toast.show { display: block; animation: toast-in .22s ease-out both; }
.toast.error { border-color: #d17a70; color: #ffd5cc; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 959px) {
  .view-shell { padding-right: 24px; padding-left: 24px; }
  .conversation-grid { grid-template-columns: 1fr; }
  .outbox-zone { order: 1; }
  .inbox-zone { order: 2; }
}

@media (max-width: 679px) {
  .view-shell { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .auth-view { display: grid; grid-template-columns: 1fr; gap: 34px; align-content: start; min-height: 100dvh; padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .auth-intro h1 { margin-top: 34px; font-size: 2.65rem; }
  .intro-copy { margin-top: 19px; font-size: 14px; line-height: 1.68; }
  .signal-card { margin-top: 26px; }
  .auth-panel { padding: 19px; box-shadow: 7px 8px 0 var(--paper-deep); }
  .auth-heading { margin: 40px 0 22px; }

  .dashboard-view { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar { min-height: 47px; }
  .brand-lockup { gap: 8px; font-size: 10px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mark::before { left: 14px; }
  .brand-mark::after { left: 12px; }
  .brand-mark i { top: 11px; width: 4px; height: 4px; }
  .brand-mark i:first-child { left: 8px; }
  .brand-mark i:nth-child(2) { right: 8px; }
  .brand-mark b { bottom: 7px; left: 10px; width: 10px; height: 3px; }
  .topbar-actions { gap: 10px; }
  .status-label { max-width: 103px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
  .dashboard-hero { display: block; padding: 38px 0 25px; }
  .hero-identity { gap: 17px; align-items: center; }
  .hero-device-mark { width: 72px; height: 72px; flex-basis: 72px; border-radius: 22px; box-shadow: 6px 7px 0 rgba(41, 37, 51, .12); }
  .hero-device-mark::before, .hero-device-mark::after { top: 29px; width: 4px; height: 16px; }
  .hero-antenna { top: 9px; left: 34px; width: 4px; height: 10px; }
  .hero-antenna::after { top: -6px; left: -3px; width: 9px; height: 9px; }
  .hero-eye { top: 29px; width: 9px; height: 9px; }
  .hero-eye.left { left: 19px; }
  .hero-eye.right { right: 19px; }
  .hero-mouth { bottom: 17px; left: 25px; width: 22px; height: 4px; }
  .dashboard-hero h1 { font-size: 2.58rem; }
  .hero-note { margin-top: 13px; font-size: 13px; line-height: 1.55; }
  .hero-aside { max-width: 280px; margin: 23px 0 0 89px; }
  .hero-aside p { margin-top: 8px; font-size: 12px; }

  .device-strip { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 13px; }
  .device-orb { width: 42px; height: 42px; }
  .device-state { grid-column: 1 / -1; grid-template-columns: 10px auto 1fr; min-width: 0; padding: 12px 0 0; border-top: 1px solid #514a5c; border-left: 0; }

  .conversation-grid { gap: 16px; margin-top: 16px; }
  .conversation-zone { padding: 18px; border-radius: 16px; }
  .message-board { margin-top: 16px; }
  .message-board-frame { padding: 14px; border-radius: 16px; box-shadow: 6px 7px 0 rgba(41, 37, 51, .11); }
  .message-board-heading { align-items: flex-start; gap: 12px; padding-bottom: 12px; }
  .message-board-heading h2 { font-size: 1.16rem; }
  .message-board-heading p { font-size: 10px; }
  .message-board-count { padding-top: 2px; }
  .blackboard-surface { min-height: 190px; padding: 24px 12px 34px; border-width: 6px; }
  .message-board-list { grid-template-columns: 1fr; gap: 13px; }
  .message-board-item { min-height: 132px; padding: 23px 14px 14px; }
  .blackboard-signature { right: 13px; bottom: 10px; font-size: 7px; }
  .zone-header { grid-template-columns: 36px minmax(0, 1fr); gap: 11px; padding-bottom: 19px; }
  .zone-symbol { width: 36px; height: 36px; border-radius: 11px; }
  .zone-kind { grid-column: 2; justify-self: start; margin-top: -4px; }
  .zone-header-copy h2 { font-size: 1.45rem; }
  .zone-header-copy p { font-size: 11px; }
  .compose-card { padding-top: 19px; gap: 16px; }
  .composer-switch { grid-template-columns: 1fr; }
  .composer-tab { grid-template-columns: 32px 1fr; }
  .compose-panel { padding-top: 18px; }
  .field-message textarea { min-height: 140px; }
  .delivery-grid { grid-template-columns: 1fr; }
  .image-lab { padding: 15px; }
  .image-lab-footer { align-items: stretch; flex-direction: column; }
  .image-lab-footer .button { width: 100%; }
  .image-preview.generated { grid-template-columns: 92px 1fr auto; }
  .image-preview.generated img { width: 92px; height: 70px; }
  .choice-grid { gap: 8px; }
  .compose-footer { align-items: stretch; }
  .compose-footer .button { min-width: 0; flex: 1; }
  .photo-module-heading { flex-direction: column; gap: 12px; }
  .photo-module-heading .button { width: 100%; }
  .remote-photo-preview { grid-template-columns: 1fr; }
  .remote-photo-meta { grid-template-columns: 1fr 1fr; gap: 4px 10px; }
  .remote-photo-meta strong { grid-column: 1 / -1; }
  .remote-photo-meta .photo-delete-button { grid-column: 1 / -1; }
  .photo-history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .image-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-bar { align-items: flex-start; flex-direction: column; margin-top: 38px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .view-shell { padding-right: 12px; padding-left: 12px; }
  .dashboard-hero h1 { font-size: 2.38rem; }
  .hero-aside { margin-left: 0; }
  .compose-footer { flex-direction: column; }
  .compose-footer .button { width: 100%; }
  .counter { align-self: flex-end; }
}

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