:root {
  --ink: var(--aqua-ink);
  --accent: var(--aqua-primary);
  --line: var(--aqua-line);
  --paper: #fff;
  --muted: var(--aqua-muted);
  background: var(--aqua-mist);
  color: var(--ink);
  font:
    16px/1.55 "Noto Sans TC",
    "PingFang TC",
    system-ui,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
input[type="submit"],
a {
  cursor: pointer;
}
button,
input[type="submit"] {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 0.55rem 0.9rem;
  border-radius: 7px;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:hover:not(:disabled),
a:hover {
  filter: brightness(0.95);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(29px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.05em;
}
h2 {
  font-size: 20px;
}
small,
.muted {
  color: var(--muted);
}
header,
.heading,
.identity,
.brand,
.chat-head,
.composer > div,
nav {
  display: flex;
  align-items: center;
}
.brand {
  gap: 0.6rem;
  font-size: 21px;
  font-weight: 800;
}
.brand small {
  border-left: 1px solid var(--line);
  padding-left: 0.7rem;
  font-size: 14px;
  font-weight: 500;
}
.mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-family: serif;
  font-weight: 500;
}
header {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 max(4vw, 20px);
  justify-content: space-between;
}
.identity {
  gap: 14px;
  font-size: 14px;
}
.primary,
input.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.secondary {
  background: #f6fbfd;
}
.quiet {
  background: transparent;
  padding: 0.35rem 0.7rem;
}
.desk,
.admin {
  max-width: 1370px;
  margin: auto;
  padding: 30px 4vw;
}
.heading {
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 24px;
}
.eyebrow {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}
.pill {
  white-space: nowrap;
  border-radius: 20px;
  padding: 0.22rem 0.7rem;
  background: var(--aqua-tint);
  color: var(--aqua-deep);
  font-size: 13px;
}
.pill.manual,
.pill.system {
  background: var(--aqua-warning-bg);
  color: var(--aqua-warning);
}
.inbox-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(240px, 31%) 1fr;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--aqua-shadow);
  border-radius: 14px;
  overflow: hidden;
}
.threads {
  border-right: 1px solid var(--line);
  max-height: 80vh;
  overflow: auto;
}
.filters,
.panel,
.chat-head,
.composer,
.history,
.pending {
  padding: 18px 22px;
}
.filters h2 small {
  font-size: 13px;
}
.filters input,
.filters select {
  width: 100%;
  margin-top: 8px;
}
input:not([type="checkbox"]):not([type="submit"]),
select,
textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #9fbecb;
  color: var(--ink);
  background: white;
  min-width: 0;
}
:is(input:not([type="checkbox"], [type="radio"], [type="submit"]), select, textarea):focus {
  padding: calc(0.6rem - 1px) calc(0.75rem - 1px);
  border: 2px solid var(--accent);
  outline: 0;
}
.thread {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  padding: 16px 18px;
}
.thread.selected,
.selected {
  background: var(--aqua-tint);
}
.thread.selected {
  box-shadow: inset 3px 0 var(--accent);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  background: #c5e5ee;
  border-radius: 12px;
  font-weight: bold;
}
.summary {
  flex: auto;
  min-width: 0;
}
.summary > * {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summary > span {
  font-size: 13px;
  color: var(--muted);
}
.thread i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #d49a48;
}
.thread i.listening {
  background: #1383a3;
}
.chat {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-head {
  gap: 12px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.history {
  background: #f6f8f9;
  min-height: 220px;
  max-height: 52vh;
  overflow: auto;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
}
.message {
  max-width: 83%;
  align-self: flex-start;
}
.message.out {
  align-self: flex-end;
  text-align: right;
}
.message small {
  font-size: 12px;
}
.bubble {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  white-space: pre-wrap;
  text-align: left;
  overflow-wrap: anywhere;
}
.out .bubble {
  background: var(--aqua-tint);
}
.bubble img {
  display: block;
  max-width: 100%;
  max-height: 260px;
}
.composer {
  border-top: 1px solid var(--line);
}
.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 68px;
}
.composer > div {
  justify-content: space-between;
  margin-top: 8px;
}
.pending,
.flash {
  background: var(--aqua-warning-bg);
  color: var(--aqua-warning);
}
.flash.error {
  background: var(--aqua-danger-bg);
  color: var(--aqua-danger);
}
.flash.notice {
  background: var(--aqua-success-bg);
  color: var(--aqua-success);
}
.pending small {
  display: inline-block;
  margin-left: 10px;
}
.flash {
  padding: 10px 4vw;
}
.back {
  display: none;
}
.empty {
  padding: 36px 20px;
  color: var(--muted);
}
label {
  display: block;
  margin: 11px 0;
  font-weight: 600;
  font-size: 14px;
}
label input:not([type="checkbox"]),
label textarea,
label select {
  display: block;
  margin-top: 4px;
  width: 100%;
  font-weight: 400;
}
.landing {
  margin: 8vh auto;
  max-width: 930px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--aqua-shadow);
  border-radius: 18px;
  overflow: hidden;
}
.welcome,
.loginbox {
  padding: clamp(26px, 5vw, 64px);
}
.welcome {
  background: repeating-radial-gradient(ellipse at 110% -30%, transparent 0 30px, rgb(255 255 255 / 24%) 31px 32px, transparent 33px 50px), var(--aqua-ocean);
  color: var(--aqua-ink);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  flex-direction: column;
  gap: 15px;
}
.logo-art {
  color: var(--aqua-primary);
  font-size: 100px;
  line-height: 1;
}
.loginbox {
  align-self: center;
}
.loginbox form button,
.loginbox input[type="submit"] {
  width: 100%;
  margin-top: 12px;
}
.loginbox p {
  margin: 12px 0;
}
.admin-grid {
  grid-template-columns: minmax(180px, 24%) 1fr;
}
.panel {
  padding: 24px;
}
.panel + section {
  border-left: 1px solid var(--line);
}
.panel a,
nav a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  padding: 8px;
  border-radius: 5px;
}
nav {
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.active {
  background: var(--ink);
  color: white;
}
.admin nav a.active {
  color: white;
}
.heading form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.heading form label {
  margin: 0;
}
.check {
  font-weight: 400;
}
.check input {
  margin-right: 8px;
}
.panel table {
  width: 100%;
  font-size: 14px;
  text-align: left;
  border-collapse: collapse;
}
.panel td,
.panel th {
  padding: 6px;
  border-bottom: 1px solid var(--line);
}
details {
  padding: 10px 18px;
}
.admin > .panel {
  overflow: auto;
  background: white;
}
@media (max-width: 720px) {
  .desk,
  .admin {
    padding: 20px 12px;
  }
  .heading {
    align-items: start;
  }
  .inbox-grid,
  .admin-grid,
  .landing {
    grid-template-columns: 1fr;
  }
  .threads {
    border: 0;
  }
  .inbox-grid .chat,
  .detail .threads {
    display: none;
  }
  .detail .chat,
  .back {
    display: flex;
  }
  .landing {
    margin: 24px 12px;
  }
  .logo-art {
    font-size: 48px;
  }
  .welcome {
    gap: 6px;
  }
  .history {
    max-height: 46vh;
  }
  .identity > span {
    max-width: 130px;
    font-size: 12px;
  }
  .panel + section {
    border: 0;
  }
  .panel {
    padding: 16px;
  }
  .admin-grid aside a {
    display: inline-block;
  }
  .heading form {
    align-items: end;
  }
  header {
    padding: 0 12px;
  }
  .brand small {
    display: none;
  }
}
