:root {
  --bg: #f3f1ea;
  --panel: #fffdf8;
  --ink: #1c2733;
  --muted: #5b6875;
  --line: #d9d5c9;
  --brand: #27455c;
  --on-brand: #fff;
  --accent: #e4572e;
  --bubble: #dcebf1;
  --bad: #b3261e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1820;
    --panel: #17232d;
    --ink: #eaf0f3;
    --muted: #9fb0bc;
    --line: #2c3c49;
    --brand: #1e3647;
    --bubble: #21384a;
    --bad: #ff8a80;
  }
}
* {
  box-sizing: border-box;
}
html,
body,
#root {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px / 20px system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}
h1,
h2,
p {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button:disabled {
  opacity: 0.6;
  cursor: default;
}
button.quiet {
  background: transparent;
  color: inherit;
  font-weight: 400;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}
input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
a {
  color: inherit;
}

.card {
  width: 100%;
  max-width: 360px;
  margin: 10vh auto 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h1 {
  font-size: 20px;
  line-height: 28px;
}
.card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}
.note {
  color: var(--muted);
}
.bad {
  color: var(--bad);
}

.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 0 16px;
  min-height: 52px;
  background: var(--brand);
  color: var(--on-brand);
}
.top h1 {
  font-size: 16px;
  font-weight: 600;
}
.banner {
  padding: 4px 16px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
}
.inbox {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
}
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1;
  background: transparent;
  color: inherit;
  font-weight: 400;
}
.tabs button[aria-pressed="true"] {
  background: var(--bubble);
  font-weight: 600;
}
.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.row {
  display: block;
  width: 100%;
  min-height: 64px;
  height: auto;
  padding: 10px 16px;
  text-align: left;
  background: transparent;
  color: inherit;
  font-weight: 400;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.row[aria-current="true"] {
  background: var(--bubble);
}
.row strong {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row span {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty {
  padding: 24px 16px;
  color: var(--muted);
}

.thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.thread-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.thread-head h2 {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.back {
  display: none;
}
.context {
  margin: 0;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.context dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  align-self: flex-end;
  max-width: min(85%, 640px);
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.visitor {
  align-self: flex-start;
  background: var(--bubble);
  color: inherit;
}
.state {
  align-self: flex-end;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}
.retry {
  min-height: 0;
  padding: 0;
  align-self: flex-end;
  background: transparent;
  color: var(--bad);
  font-size: 12px;
  font-weight: 400;
  text-decoration: underline;
}
.reply {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.reply textarea {
  resize: none;
  height: 44px;
  flex: 1;
}

@media (max-width: 720px) {
  .inbox {
    grid-template-columns: 1fr;
  }
  .inbox.showing .side {
    display: none;
  }
  .inbox:not(.showing) .thread {
    display: none;
  }
  .back {
    display: inline-block;
  }
}

.shot {
  padding: 0;
  border: 0;
  cursor: zoom-in;
  display: block;
  align-self: flex-end;
  max-width: min(85%, 480px);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bubble);
}
.shot.visitor {
  align-self: flex-start;
}
.shot img {
  display: block;
  max-width: 100%;
  height: auto;
}
.thread.drop {
  outline: 3px dashed var(--accent);
  outline-offset: -6px;
}
.file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.pick {
  padding: 0 8px;
}
.problem {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--bad);
}
.viewer {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 95vw;
  max-height: 95vh;
  overflow: auto;
}
.viewer::backdrop {
  background: rgba(0, 0, 0, 0.8);
}
.viewer img {
  display: block;
  max-width: none;
}
.alerts {
  width: min(420px, 90vw);
  padding: 20px;
  border: 1px solid var(--line, #d9d5c9);
  border-radius: 12px;
  background: var(--panel, Canvas);
  color: inherit;
}
.alerts::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.alerts section {
  margin: 16px 0;
}
.alerts h2,
.alerts h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.alert-actions {
  display: flex;
  gap: 8px;
}
.alerts .hint {
  font-size: 12px;
  opacity: 0.75;
}
.alerts .check {
  display: flex;
  gap: 8px;
  align-items: center;
}
.top-actions {
  display: flex;
  gap: 8px;
}
.settings {
  width: min(640px, 95vw);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
}
.settings::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.settings section,
.settings form {
  margin: 20px 0;
}
.settings h2,
.settings h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.settings .hint {
  font-size: 12px;
  color: var(--muted);
}
.settings pre {
  margin: 8px 0;
  padding: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.settings textarea {
  width: 100%;
  margin-bottom: 8px;
}
.team {
  margin: 8px 0;
  padding: 0;
  list-style: none;
}
.team li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.team li > span:first-child {
  flex: 1 1 200px;
  overflow-wrap: anywhere;
}
.row small {
  display: block;
  color: var(--muted);
}
.replying {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--muted);
}
.row em {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.empty-boat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
}
.ship {
  display: block;
  animation: bob 3.2s steps(1) infinite;
}
.ship svg {
  display: block;
}
@keyframes bob {
  50% {
    transform: translateY(-3px);
  }
}
@media (prefers-color-scheme: dark) {
  .ship {
    --d-hull: #7fb2cf;
    --d-hull-low: #4f7f9c;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ship {
    animation: none;
  }
}
.b-m {
  fill: #7a4f2a;
}
.b-s {
  fill: #e4572e;
}
.b-t {
  fill: #b93f1c;
}
.b-h {
  fill: var(--d-hull, #27455c);
}
.b-d {
  fill: var(--d-hull-low, #172d3e);
}
.confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.confirm p {
  flex: 1 1 100%;
  margin: 0;
}
.thread-head {
  flex-wrap: wrap;
}
