:root {
  color-scheme: light;
  --paper: #f5f4ee;
  --surface: #ffffff;
  --surface-warm: #fffaf0;
  --honey: #ffd84d;
  --honey-strong: #f2c619;
  --honey-soft: #fff4bf;
  --accent-ink: #191a15;
  --ink: #191a15;
  --muted: #74766d;
  --quiet: #a3a49b;
  --line: #e7e5da;
  --line-strong: #d8d5c7;
  --danger: #bb443a;
  --danger-soft: #fff0ee;
  --success: #51a268;
  --shadow: 0 18px 60px rgba(31, 31, 20, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --display: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  --utility: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

.auth-screen {
  position: relative;
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 600px;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(rgba(245, 244, 238, 0.82), rgba(245, 244, 238, 0.96)),
    radial-gradient(circle at 1px 1px, #d9d5c5 1px, transparent 1.2px);
  background-size:
    auto,
    22px 22px;
}

.auth-screen::before {
  position: absolute;
  top: -180px;
  left: 50%;
  width: 540px;
  height: 540px;
  background: var(--honey);
  border-radius: 50%;
  content: "";
  opacity: 0.38;
  filter: blur(2px);
  transform: translateX(-50%);
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(440px, 100%);
  padding: 34px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(216, 213, 199, 0.9);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(31, 31, 20, 0.14);
  backdrop-filter: blur(15px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 37px;
}

.auth-brand > span,
.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  font-family: var(--display);
  font-size: 15px;
}

.auth-brand small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 36px;
  font-weight: 650;
  letter-spacing: -1.4px;
  line-height: 1.03;
}

.auth-copy {
  margin: 13px 0 25px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-form .field {
  margin-top: 14px;
}

.login-button {
  width: 100%;
  margin-top: 20px;
}

.session-retry-button {
  width: 100%;
  margin-top: 10px;
}

.login-error {
  margin: 13px 2px -5px;
  padding: 9px 11px;
  color: #84372f;
  background: var(--danger-soft);
  border: 1px solid #ecc5c0;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
}

.auth-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 24px;
  color: var(--quiet);
  font-size: 9px;
  text-align: center;
}

.auth-security svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.auth-screen.session-recovery .login-form .field,
.auth-screen.session-recovery .login-button {
  display: none;
}

.auth-screen.session-recovery .login-error {
  margin-top: 20px;
}

.auth-atmosphere {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(880px, 92vw);
  height: 250px;
  color: rgba(25, 26, 21, 0.18);
  font-family: var(--display);
  font-size: clamp(70px, 10vw, 150px);
  font-weight: 700;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.auth-atmosphere span {
  position: absolute;
}

.auth-atmosphere span:first-child {
  top: -80px;
  left: 0;
}

.auth-atmosphere span:last-child {
  right: 0;
  bottom: -85px;
}

.auth-atmosphere i {
  position: absolute;
  top: 50%;
  right: 5%;
  left: 5%;
  height: 2px;
  background: rgba(242, 198, 25, 0.4);
  transform: rotate(-12deg);
}

.auth-atmosphere i::after {
  position: absolute;
  top: -5px;
  right: 0;
  width: 11px;
  height: 11px;
  background: var(--honey-strong);
  border-radius: 50%;
  content: "";
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

html,
body {
  touch-action: pan-x pan-y;
}

button {
  border: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(255, 216, 77, 0.55);
  outline-offset: 2px;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 560px;
  background: var(--surface);
}

.connection-banner {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 28px);
  min-height: 42px;
  padding: 7px 8px 7px 13px;
  color: var(--ink);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 96%, var(--honey));
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(25, 26, 21, 0.16);
  transform: translateX(-50%);
}

.connection-banner > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.connection-banner i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: #d28d1e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(210, 141, 30, 0.14);
}

.connection-banner strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-banner button {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--ink);
  background: var(--honey);
  border: 1px solid var(--honey-strong);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 25px 18px 18px;
  overflow: hidden;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 6px 0 4px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  background: var(--honey);
  border: 1px solid rgba(25, 26, 21, 0.12);
  border-radius: 14px 5px 14px 14px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -1px;
  box-shadow: 0 5px 0 rgba(25, 26, 21, 0.08);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workspace-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 22px;
  padding: 4px;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.workspace-nav-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 5px 3px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 9px;
  font-weight: 700;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.workspace-nav-button:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.workspace-nav-button.active {
  color: var(--accent-ink);
  background: var(--honey);
  border-color: var(--honey-strong);
  box-shadow: 0 3px 0 rgba(25, 26, 21, 0.09);
}

.workspace-nav-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.workspace-nav-button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.new-chat-button,
.primary-button {
  background: var(--honey);
  border: 1px solid rgba(25, 26, 21, 0.13);
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(25, 26, 21, 0.1);
  transition:
    transform 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.new-chat-button:hover,
.primary-button:hover {
  background: #ffdc5e;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 rgba(25, 26, 21, 0.1);
}

.new-chat-button:active,
.primary-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(25, 26, 21, 0.1);
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  margin: 14px 0;
  border-radius: 14px;
}

.new-chat-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 43px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 13px;
  transition:
    background 150ms ease,
    border 150ms ease;
}

.search-field:focus-within {
  background: var(--surface);
  border-color: var(--honey-strong);
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--quiet);
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.search-field input::placeholder {
  color: var(--quiet);
}

.chat-list-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 6px 9px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chat-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.chat-row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 8px 10px 8px 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  transition:
    background 150ms ease,
    border 150ms ease;
}

.chat-row:hover {
  background: rgba(255, 255, 255, 0.65);
}

.chat-row.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 5px 18px rgba(28, 28, 18, 0.04);
}

.chat-row.active::before {
  position: absolute;
  top: 17px;
  bottom: 17px;
  left: -1px;
  width: 3px;
  background: var(--honey);
  border-radius: 0 4px 4px 0;
  content: "";
}

.chat-avatar,
.supplier-avatar {
  display: grid;
  place-items: center;
  background: var(--honey-soft);
  border: 1px solid #eadb91;
  font-family: var(--display);
  font-weight: 700;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 13px;
}

.chat-row-copy {
  min-width: 0;
}

.chat-row-copy strong,
.chat-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-copy strong {
  font-size: 13px;
  font-weight: 680;
}

.chat-row-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.chat-row-time {
  align-self: start;
  padding-top: 4px;
  color: var(--quiet);
  font-family: var(--utility);
  font-size: 9px;
}

.chat-row.saved .chat-avatar,
.supplier-avatar.saved {
  color: var(--accent-ink);
  background: var(--honey);
  border-color: var(--honey-strong);
  font-size: 17px;
}

.chat-row.saved .chat-row-copy strong {
  font-weight: 760;
}

.list-empty {
  margin: 26px 10px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.sidebar-footer {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.settings-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: transparent;
  border-radius: 14px;
}

.settings-button:hover {
  background: rgba(255, 255, 255, 0.68);
}

.settings-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.settings-icon svg {
  width: 18px;
  height: 18px;
}

.settings-button strong,
.settings-button small {
  display: block;
}

.settings-button strong {
  font-size: 12px;
  font-weight: 650;
}

.settings-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--quiet);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.status-dot.connected {
  background: var(--success);
}

.main-panel {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}

.empty-state {
  position: relative;
  display: flex;
  width: min(720px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.empty-visual {
  position: relative;
  display: flex;
  width: min(480px, 90%);
  min-height: 155px;
  margin-bottom: 30px;
  flex-direction: column;
}

.empty-bubble {
  position: relative;
  z-index: 1;
  max-width: 72%;
  padding: 16px 20px;
  border: 1px solid var(--line-strong);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 12px 34px rgba(25, 26, 21, 0.06);
}

.empty-bubble.source {
  align-self: flex-end;
  background: var(--honey);
  border-color: #e8bf21;
  border-radius: 20px 6px 20px 20px;
}

.empty-bubble.translated {
  align-self: flex-start;
  margin-top: 36px;
  background: var(--surface);
  border-radius: 6px 20px 20px 20px;
}

.translation-thread {
  position: absolute;
  top: 48px;
  left: 23%;
  width: 54%;
  height: 60px;
  border-bottom: 2px solid var(--honey);
  border-left: 2px solid var(--honey);
  border-radius: 0 0 0 20px;
  transform: skewX(-18deg);
}

.translation-thread::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: var(--honey);
  border-radius: 50%;
  content: "";
}

.eyebrow {
  margin: 0 0 12px;
  color: #8c7000;
  font-family: var(--utility);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.empty-state h1 {
  max-width: 650px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(35px, 5vw, 60px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.empty-copy {
  max-width: 570px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 13px;
}

.empty-cta {
  min-width: 190px;
  margin-top: 30px;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 24px;
  color: var(--quiet);
  font-size: 11px;
}

.privacy-note svg {
  width: 15px;
  height: 15px;
}

.chat-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.93), rgba(255, 255, 255, 0.93)),
    radial-gradient(circle at 1px 1px, #d9d5c5 1px, transparent 1.2px);
  background-size:
    auto,
    22px 22px;
}

.chat-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 82px;
  padding: 13px 28px;
  background: rgba(255, 255, 255, 0.93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.mobile-menu-button {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.supplier-avatar {
  width: 48px;
  height: 48px;
  border-radius: 15px 6px 15px 15px;
  font-size: 14px;
}

.supplier-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 5px 6px 5px 0;
  text-align: left;
  background: transparent;
  border-radius: 9px;
}

.supplier-heading > span {
  min-width: 0;
}

.supplier-heading strong,
.supplier-heading small {
  display: block;
}

.supplier-heading strong {
  max-width: min(34vw, 420px);
  overflow: hidden;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-heading small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.supplier-heading small i {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.supplier-heading > svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--quiet);
  opacity: 0;
  transition: opacity 150ms ease;
}

.supplier-heading:hover > svg {
  opacity: 1;
}

.supplier-heading.saved {
  cursor: default;
}

.supplier-heading.saved > svg {
  display: none;
}

.speaker-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speaker-control > span {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.speaker-option {
  min-width: 78px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 650;
  transition:
    color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.speaker-option.active {
  color: var(--ink);
  background: var(--honey);
  box-shadow: 0 2px 5px rgba(53, 43, 0, 0.1);
}

.message-feed {
  min-height: 0;
  padding: 38px max(32px, calc((100% - 990px) / 2)) 50px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
}

.message-history-state {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  margin: -18px auto 24px;
  color: var(--muted);
  font-size: 10px;
}

.message-history-state.loading {
  gap: 9px;
}

.message-history-state.loading i {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--honey-strong);
  border-radius: 50%;
  animation: history-spin 700ms linear infinite;
}

.message-history-state button {
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 650;
}

.message-history-state.error {
  gap: 10px;
  color: var(--danger);
}

.conversation-loading {
  display: grid;
  min-height: 100%;
  place-items: center;
}

.conversation-loading > span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.conversation-loading i {
  width: 17px;
  height: 17px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--honey-strong);
  border-radius: 50%;
  animation: history-spin 700ms linear infinite;
}

@keyframes history-spin {
  to {
    transform: rotate(360deg);
  }
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 34px;
  color: var(--quiet);
  font-family: var(--utility);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-divider::before,
.day-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.message-group {
  display: flex;
  margin: 0 0 32px;
  flex-direction: column;
  align-items: flex-start;
}

.message-group.mine {
  align-items: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 9px 7px;
  color: var(--muted);
  font-size: 10px;
}

.message-meta strong {
  color: var(--ink);
  font-weight: 650;
}

.message-meta time {
  font-family: var(--utility);
  font-size: 9px;
}

.message-stack {
  position: relative;
  width: min(690px, 78%);
}

.original-bubble {
  position: relative;
  z-index: 2;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px 18px 18px 18px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 8px 28px rgba(30, 30, 18, 0.055);
}

.mine .original-bubble {
  background: var(--honey);
  border-color: #e7be1e;
  border-radius: 18px 6px 18px 18px;
}

.translation-card {
  position: relative;
  z-index: 1;
  margin: -5px 13px 0;
  padding: 20px 46px 15px 17px;
  background: var(--surface-warm);
  border: 1px solid #eadfba;
  border-top: 0;
  border-radius: 0 0 15px 15px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.translation-card::before {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: -1px;
  width: 3px;
  background: var(--honey);
  border-radius: 0 3px 3px 0;
  content: "";
}

.translation-card.queued {
  background: var(--surface);
}

.queue-mark {
  color: var(--honey-strong);
  font-family: var(--utility);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
}

.translation-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: #8c7000;
  font-family: var(--utility);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.translation-label::before {
  width: 5px;
  height: 5px;
  background: var(--honey-strong);
  border-radius: 50%;
  content: "";
}

.translation-text {
  white-space: pre-wrap;
}

.copy-button,
.retry-button {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.copy-button {
  position: absolute;
  top: 13px;
  right: 12px;
  width: 31px;
  height: 31px;
}

.copy-button:hover,
.retry-button:hover {
  color: var(--ink);
  border-color: var(--honey-strong);
}

.copy-button svg {
  width: 14px;
  height: 14px;
}

.translation-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  background: var(--honey-strong);
  border-radius: 50%;
  animation: typing 1.1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.translation-card.error {
  background: var(--danger-soft);
  border-color: #ecc5c0;
}

.translation-card.error::before {
  background: var(--danger);
}

.translation-card.error .translation-label {
  color: var(--danger);
}

.translation-card.error .translation-label::before {
  background: var(--danger);
}

.error-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #84372f;
}

.retry-button {
  width: auto;
  min-height: 32px;
  flex: 0 0 auto;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
}

.conversation-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  text-align: center;
}

.conversation-empty-inner {
  max-width: 420px;
  padding: 36px;
}

.conversation-empty-icon {
  position: relative;
  width: 74px;
  height: 62px;
  margin: 0 auto 20px;
}

.conversation-empty-icon::before,
.conversation-empty-icon::after {
  position: absolute;
  width: 43px;
  height: 31px;
  border: 1px solid var(--line-strong);
  content: "";
}

.conversation-empty-icon::before {
  top: 0;
  right: 0;
  background: var(--honey);
  border-color: #e7be1e;
  border-radius: 13px 4px 13px 13px;
}

.conversation-empty-icon::after {
  bottom: 0;
  left: 0;
  background: var(--surface);
  border-radius: 4px 13px 13px 13px;
}

.conversation-empty h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: -0.6px;
}

.conversation-empty p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.conversation-empty.saved .conversation-empty-icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--honey);
  border: 1px solid var(--honey-strong);
  border-radius: 21px 7px 21px 21px;
  box-shadow: 0 9px 0 rgba(25, 26, 21, 0.08);
}

.conversation-empty.saved .conversation-empty-icon::before {
  position: static;
  width: auto;
  height: auto;
  color: inherit;
  background: transparent;
  border: 0;
  content: "★";
  font-size: 25px;
}

.conversation-empty.saved .conversation-empty-icon::after {
  display: none;
}

.composer-wrap {
  position: relative;
  z-index: 2;
  padding: 12px max(28px, calc((100% - 990px) / 2)) 20px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 24%);
}

.composer {
  padding: 11px 12px 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 12px 42px rgba(30, 30, 18, 0.09);
}

.composer:focus-within {
  border-color: #ddbc32;
  box-shadow:
    0 12px 42px rgba(30, 30, 18, 0.09),
    0 0 0 3px rgba(255, 216, 77, 0.15);
}

.composer-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
  color: var(--quiet);
  font-size: 9px;
}

.author-chip {
  padding: 4px 8px;
  color: #705b00;
  background: var(--honey-soft);
  border-radius: 7px;
  font-family: var(--utility);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.dictation-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 2px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.dictation-button:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.dictation-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.dictation-button svg {
  width: 18px;
  height: 18px;
}

.dictation-button.is-recording {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  animation: dictation-pulse 1.8s ease-out infinite;
}

.dictation-button.is-processing svg {
  animation: dictation-thinking 900ms ease-in-out infinite alternate;
}

.composer.is-recording {
  border-color: var(--danger);
  box-shadow:
    0 12px 42px rgba(30, 30, 18, 0.09),
    0 0 0 3px rgba(187, 68, 58, 0.13);
}

@keyframes dictation-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(187, 68, 58, 0.24);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(187, 68, 58, 0);
  }
}

@keyframes dictation-thinking {
  to {
    opacity: 0.38;
    transform: scale(0.86);
  }
}

.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 170px;
  padding: 10px 8px 7px;
  resize: none;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--quiet);
}

.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  background: var(--honey);
  border: 1px solid #e7be1e;
  border-radius: 13px 5px 13px 13px;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.send-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.composer-hint {
  display: flex;
  justify-content: space-between;
  padding: 6px 6px 0;
  color: var(--quiet);
  font-family: var(--utility);
  font-size: 8px;
}

.dictation-status {
  margin-right: auto;
  color: var(--danger);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dictation-status.is-processing {
  color: var(--muted);
}

.dialogue-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 64px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(245, 244, 238, 0.95), rgba(245, 244, 238, 0.95)),
    radial-gradient(circle at 1px 1px, #d9d5c5 1px, transparent 1.2px);
  background-size: auto, 22px 22px;
}

.dialogue-side {
  min-height: 0;
  overflow: hidden;
}

.dialogue-side-partner {
  background: color-mix(in srgb, var(--surface) 91%, var(--honey));
}

.dialogue-side-me {
  background: color-mix(in srgb, var(--paper) 74%, var(--surface));
}

.dialogue-side-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 13px 24px 12px;
}

.dialogue-side-partner .dialogue-side-inner {
  padding-bottom: max(12px, env(safe-area-inset-top));
  transform: rotate(180deg);
}

.dialogue-side-me .dialogue-side-inner {
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.dialogue-side-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 0 3px 8px;
}

.dialogue-person-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 11px 4px 11px 11px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 800;
}

.dialogue-person-mark.me {
  background: var(--honey);
  border-color: var(--honey-strong);
}

.dialogue-side-header strong,
.dialogue-side-header small {
  display: block;
}

.dialogue-side-header strong {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 750;
}

.dialogue-side-header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.dialogue-turn-status {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dialogue-feed {
  min-height: 0;
  padding: 5px 4px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.dialogue-empty {
  display: flex;
  width: min(430px, 92%);
  min-height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.dialogue-empty-symbol {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--honey);
  border: 1px solid var(--honey-strong);
  border-radius: 15px 5px 15px 15px;
  font-family: var(--utility);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 0 rgba(25, 26, 21, 0.08);
}

.dialogue-empty strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
}

.dialogue-empty p {
  max-width: 390px;
  margin: 6px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

.dialogue-turn {
  width: min(630px, 82%);
  margin: 0 0 14px;
  padding: 10px 12px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px 15px 15px 15px;
  box-shadow: 0 7px 22px rgba(30, 30, 18, 0.055);
}

.dialogue-turn.received {
  margin-right: auto;
}

.dialogue-turn.own {
  margin-left: auto;
  color: var(--accent-ink);
  background: var(--honey);
  border-color: var(--honey-strong);
  border-radius: 15px 5px 15px 15px;
}

.dialogue-turn.error {
  border-color: var(--danger);
}

.dialogue-turn > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
}

.dialogue-turn.own > header {
  color: rgba(25, 26, 21, 0.64);
}

.dialogue-turn > header strong {
  font-size: 9px;
  font-weight: 750;
}

.dialogue-turn > header time {
  font-family: var(--utility);
}

.dialogue-turn-primary > span,
.dialogue-turn-translation > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dialogue-turn.own .dialogue-turn-primary > span,
.dialogue-turn.own .dialogue-turn-translation > span {
  color: rgba(25, 26, 21, 0.6);
}

.dialogue-turn p {
  margin: 0;
  line-height: 1.42;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.dialogue-turn-primary p {
  font-size: clamp(13px, 1.7vh, 17px);
  font-weight: 620;
}

.dialogue-turn-translation {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
}

.dialogue-turn.own .dialogue-turn-translation {
  border-top-color: rgba(25, 26, 21, 0.15);
}

.dialogue-turn.own .dialogue-turn-translation p {
  color: rgba(25, 26, 21, 0.76);
}

.dialogue-turn-translation p {
  color: color-mix(in srgb, var(--ink) 78%, var(--muted));
  font-size: clamp(10px, 1.25vh, 13px);
}

.dialogue-loading {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.dialogue-loading i {
  width: 4px;
  height: 4px;
  background: var(--honey-strong);
  border-radius: 50%;
  animation: typing 1.1s infinite ease-in-out;
}

.dialogue-loading i:nth-child(2) {
  animation-delay: 120ms;
}

.dialogue-loading i:nth-child(3) {
  margin-right: 3px;
  animation-delay: 240ms;
}

.dialogue-error-text {
  color: var(--danger);
}

.dialogue-retry-button {
  min-height: 28px;
  margin-top: 8px;
  padding: 0 9px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 42%, transparent);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
}

.dialogue-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(30, 30, 18, 0.08);
}

.dialogue-composer:focus-within {
  border-color: var(--honey-strong);
  box-shadow:
    0 8px 28px rgba(30, 30, 18, 0.08),
    0 0 0 3px rgba(255, 216, 77, 0.14);
}

.dialogue-voice-button {
  display: flex;
  min-width: 108px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--accent-ink);
  background: var(--honey);
  border: 1px solid var(--honey-strong);
  border-radius: 12px 5px 12px 12px;
  font-size: 11px;
  font-weight: 750;
  box-shadow: 0 3px 0 rgba(25, 26, 21, 0.09);
  transition:
    transform 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.dialogue-voice-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(25, 26, 21, 0.09);
}

.dialogue-voice-button svg {
  width: 17px;
  height: 17px;
}

.dialogue-voice-button.is-recording {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  animation: dictation-pulse 1.8s ease-out infinite;
}

.dialogue-voice-button.is-processing svg {
  animation: dictation-thinking 900ms ease-in-out infinite alternate;
}

.dialogue-voice-button:disabled,
.dialogue-send-button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.dialogue-text-field,
.dialogue-text-field textarea {
  width: 100%;
  min-width: 0;
}

.dialogue-text-field textarea {
  display: block;
  min-height: 40px;
  max-height: 72px;
  padding: 9px 6px 6px;
  resize: none;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.45;
}

.dialogue-text-field textarea::placeholder {
  color: var(--quiet);
}

.dialogue-send-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--surface);
  background: var(--ink);
  border-radius: 12px;
}

.dialogue-send-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.dialogue-composer.is-busy .dialogue-send-button {
  opacity: 0.42;
  pointer-events: none;
}

.dialogue-axis {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 8px 18px;
  color: var(--accent-ink);
  background: var(--honey);
  border-top: 1px solid var(--honey-strong);
  border-bottom: 1px solid var(--honey-strong);
  box-shadow: 0 0 30px rgba(98, 77, 0, 0.12);
}

.dialogue-axis-name {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  font-family: var(--utility);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialogue-axis-name i {
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(187, 68, 58, 0.13);
}

.dialogue-language-field {
  display: block;
  justify-self: center;
}

.dialogue-language-field select {
  width: min(300px, 38vw);
  min-height: 42px;
  padding: 0 34px 0 14px;
  color: var(--accent-ink);
  background-color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(25, 26, 21, 0.2);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
}

.dialogue-clear-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  justify-self: end;
  color: var(--accent-ink);
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(25, 26, 21, 0.15);
  border-radius: 10px;
}

.dialogue-clear-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.dialogue-clear-button svg {
  width: 16px;
  height: 16px;
}

.dialogue-menu-button {
  display: none;
}

.sidebar-scrim {
  display: none;
}

.modal {
  width: min(520px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(20, 20, 14, 0.42);
  backdrop-filter: blur(5px);
}

.modal[open] {
  animation: modal-in 180ms ease-out;
}

@keyframes modal-in {
  from {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
  }
}

.modal-card {
  position: relative;
  padding: 31px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  background: var(--paper);
  border-radius: 10px;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 29px;
  font-weight: 650;
  letter-spacing: -0.8px;
}

.modal-copy {
  margin: 10px 0 27px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.field {
  display: block;
  margin-top: 19px;
}

.field > span {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  height: 47px;
  padding: 0 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  font-size: 13px;
}

.field input:focus,
.field select:focus {
  background: var(--surface);
  border-color: var(--honey-strong);
}

.field > small {
  display: block;
  margin: 7px 2px 0;
  color: var(--quiet);
  font-size: 10px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 85px;
  font-family: var(--utility);
}

.password-field button {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 33px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 650;
}

.modal#settingsDialog {
  width: min(780px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.server-load-panel {
  margin: 0 0 14px;
  padding: 14px 15px 11px;
  background: var(--surface-warm);
  border: 1px solid #eadfba;
  border-radius: 15px;
}

.server-load-heading,
.server-load-foot,
.load-metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.server-load-heading > span:first-child strong,
.server-load-heading > span:first-child small {
  display: block;
}

.server-load-heading > span:first-child strong {
  font-size: 11px;
}

.server-load-heading > span:first-child small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.server-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: 9px;
}

.server-state i,
.live-mark i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent);
}

.server-state b {
  font-weight: 700;
}

.server-state[data-state="loading"] {
  color: var(--muted);
}

.server-state[data-state="warm"] {
  color: #a87900;
}

.server-state[data-state="high"],
.server-state[data-state="offline"] {
  color: var(--danger);
}

.server-state[data-state="normal"] i,
.live-mark i {
  animation: live-pulse 2.4s ease-out infinite;
}

@keyframes live-pulse {
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, currentColor 0%, transparent);
  }
}

.server-load-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 15px;
}

.load-metric-label {
  font-family: var(--utility);
}

.load-metric-label span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.load-metric-label strong {
  font-size: 11px;
}

.load-track,
.language-track,
.direction-track {
  position: relative;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.load-track {
  height: 6px;
  margin-top: 8px;
}

.load-track i,
.language-track i,
.direction-track i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: block;
  background: var(--honey-strong);
  border-radius: inherit;
}

.load-track i {
  width: var(--load, 0%);
  transition:
    width 480ms cubic-bezier(0.22, 1, 0.36, 1),
    background 180ms ease;
}

.load-track[data-level="warm"] i {
  background: #d99a16;
}

.load-track[data-level="high"] i {
  background: var(--danger);
}

.load-metric > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 8px;
}

.load-metric > .memory-cache-detail {
  min-height: 1em;
  margin-top: 2px;
  color: var(--quiet);
}

.server-load-foot {
  margin-top: 12px;
  padding-top: 9px;
  color: var(--muted);
  border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  font-family: var(--utility);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-weight: 700;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.settings-tab {
  display: flex;
  min-height: 38px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}

.settings-tab span {
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  background: var(--line);
  border-radius: 6px;
  font-family: var(--utility);
  font-size: 8px;
}

.settings-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 3px 9px rgba(25, 26, 21, 0.07);
}

.settings-tab.active span {
  background: var(--honey);
}

.settings-panel {
  padding-top: 3px;
}

.statistics-panel {
  min-height: 355px;
}

.statistics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.statistics-range {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 3px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.statistics-range button {
  min-height: 31px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
}

.statistics-range button.active {
  color: var(--accent-ink);
  background: var(--honey);
}

.statistics-download {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
}

.statistics-download:hover {
  border-color: var(--honey-strong);
}

.statistics-download svg {
  width: 14px;
  height: 14px;
}

.statistics-content {
  padding-top: 16px;
}

.statistics-loading,
.statistics-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.statistics-loading {
  gap: 11px;
  font-size: 10px;
}

.statistics-loading i {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--honey-strong);
  border-radius: 50%;
  animation: statistics-spin 700ms linear infinite;
}

@keyframes statistics-spin {
  to {
    transform: rotate(360deg);
  }
}

.statistics-empty {
  gap: 6px;
  padding: 28px;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
}

.statistics-empty > span {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--honey);
  border-radius: 13px 5px 13px 13px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
}

.statistics-empty strong {
  color: var(--ink);
  font-size: 12px;
}

.statistics-empty small {
  max-width: 310px;
  font-size: 9px;
  line-height: 1.5;
}

.statistics-empty.error strong {
  color: var(--danger);
}

.statistics-overview {
  display: grid;
  grid-template-columns: minmax(175px, 0.8fr) minmax(300px, 1.8fr);
  gap: 22px;
  align-items: stretch;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.statistics-primary {
  display: grid;
  align-content: center;
  padding-left: 2px;
}

.statistics-primary small {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.statistics-primary strong {
  margin-top: 2px;
  font-family: var(--display);
  font-size: 48px;
  font-weight: 650;
  letter-spacing: -2.5px;
  line-height: 1;
}

.statistics-primary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.statistics-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.statistics-facts > span {
  display: grid;
  min-height: 58px;
  align-content: center;
  padding: 10px 13px;
}

.statistics-facts > span:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.statistics-facts > span:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.statistics-facts small,
.statistics-facts strong {
  display: block;
}

.statistics-facts small {
  color: var(--muted);
  font-size: 8px;
}

.statistics-facts strong {
  margin-top: 5px;
  font-family: var(--utility);
  font-size: 12px;
}

.statistics-block {
  padding-top: 18px;
}

.statistics-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.statistics-section-heading strong,
.statistics-section-heading small {
  display: block;
}

.statistics-section-heading strong {
  font-size: 10px;
}

.statistics-section-heading small,
.statistics-section-heading > b {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.activity-chart {
  display: grid;
  height: 116px;
  grid-template-columns: repeat(30, minmax(3px, 1fr));
  gap: 3px;
  align-items: stretch;
  margin-top: 13px;
  padding-top: 7px;
  border-bottom: 1px solid var(--line);
}

.activity-chart.compact {
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.activity-day {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr 17px;
  align-items: end;
  justify-items: stretch;
}

.activity-column {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  align-self: stretch;
}

.activity-column i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--activity);
  min-height: 2px;
  background: var(--honey);
  border-radius: 4px 4px 1px 1px;
  transition: height 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.activity-day:hover .activity-column i {
  background: var(--honey-strong);
}

.activity-day small {
  overflow: hidden;
  margin-top: 5px;
  color: var(--quiet);
  font-family: var(--utility);
  font-size: 6px;
  opacity: 0;
  text-align: center;
  white-space: nowrap;
}

.activity-day:first-child small,
.activity-day:last-child small,
.activity-chart.compact .activity-day small {
  opacity: 1;
}

.statistics-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 27px;
}

.language-list {
  display: grid;
  gap: 12px;
  margin-top: 15px;
}

.language-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.1fr) minmax(70px, 1fr) 31px;
  gap: 10px;
  align-items: center;
}

.language-row > span {
  min-width: 0;
}

.language-row strong,
.language-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-row strong {
  font-size: 9px;
}

.language-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 7px;
}

.language-track {
  height: 5px;
}

.language-track i {
  width: var(--share);
}

.language-row > b {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
  text-align: right;
}

.direction-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 14px;
}

.direction-numbers span {
  min-width: 0;
}

.direction-numbers b,
.direction-numbers small {
  display: block;
}

.direction-numbers b {
  font-family: var(--utility);
  font-size: 15px;
}

.direction-numbers small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direction-track {
  height: 7px;
  margin-top: 13px;
  background: var(--line-strong);
}

.direction-track i {
  width: var(--direction);
  background: var(--honey);
}

.top-chat-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.top-chat-note strong {
  color: var(--ink);
}

.user-list {
  display: flex;
  max-height: min(335px, 37vh);
  margin-top: 17px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
}

.user-row {
  display: grid;
  grid-template-columns: 40px minmax(110px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.user-row.inactive {
  opacity: 0.6;
}

.user-avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  background: var(--honey-soft);
  border: 1px solid #eadb91;
  border-radius: 11px;
  font-family: var(--display);
  font-weight: 700;
}

.user-avatar {
  width: 40px;
  height: 40px;
  font-size: 11px;
}

.user-identity {
  min-width: 0;
}

.user-identity strong,
.user-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  font-size: 12px;
}

.user-identity small {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
}

.role-badge {
  padding: 5px 7px;
  color: #41704d;
  background: #e8f5eb;
  border-radius: 7px;
  font-family: var(--utility);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.owner {
  color: #705b00;
  background: var(--honey-soft);
}

.user-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 7px;
  padding-left: 50px;
}

.user-password-input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  font-size: 10px;
}

.user-password-input:focus {
  border-color: var(--honey-strong);
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
}

.compact-button:hover {
  border-color: var(--honey-strong);
}

.compact-button.danger {
  color: var(--danger);
}

.add-user-box {
  margin-top: 14px;
  padding: 15px;
  background: var(--surface-warm);
  border: 1px solid #eadfba;
  border-radius: 15px;
}

.add-user-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.add-user-plus {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  background: var(--honey);
  border-radius: 9px;
  font-size: 19px;
}

.add-user-heading strong,
.add-user-heading small {
  display: block;
}

.add-user-heading strong {
  font-size: 11px;
}

.add-user-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.user-form-grid .field {
  margin-top: 13px;
}

.user-password-field {
  grid-column: 1 / 2;
}

.add-user-button {
  align-self: end;
  grid-column: 2;
  grid-row: 2;
  margin-bottom: 0;
}

.openai-share-choice,
.user-openai-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.openai-share-choice {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 12px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--honey-soft) 58%, var(--paper));
  border: 1px solid #eadb91;
  border-radius: 12px;
}

.user-openai-choice {
  grid-column: 1 / -1;
  padding: 8px 10px;
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.openai-share-choice > input,
.user-openai-choice > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.openai-share-switch {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  background: var(--line-strong);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease;
}

.openai-share-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(31, 31, 20, 0.22);
  transition: transform 160ms ease;
}

.openai-share-choice > input:checked + .openai-share-switch,
.user-openai-choice > input:checked + .openai-share-switch {
  background: var(--honey-strong);
  border-color: var(--honey-strong);
}

.openai-share-choice > input:checked + .openai-share-switch i,
.user-openai-choice > input:checked + .openai-share-switch i {
  transform: translateX(16px);
}

.openai-share-choice > input:focus-visible + .openai-share-switch,
.user-openai-choice > input:focus-visible + .openai-share-switch {
  outline: 3px solid color-mix(in srgb, var(--honey) 35%, transparent);
  outline-offset: 2px;
}

.openai-share-copy {
  min-width: 0;
}

.openai-share-copy strong,
.openai-share-copy small {
  display: block;
}

.openai-share-copy strong {
  font-size: 10px;
}

.openai-share-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.member-settings {
  margin-top: 20px;
}

.member-profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  background: var(--surface-warm);
  border: 1px solid #eadfba;
  border-radius: 15px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
}

.member-profile-card strong,
.member-profile-card small {
  display: block;
}

.member-profile-card strong {
  font-size: 13px;
}

.member-profile-card small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 9px;
}

.member-settings > p {
  margin: 15px 3px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.appearance-settings {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(300px, 1.4fr);
  gap: 20px;
  align-items: center;
  margin: -7px 0 18px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}

.appearance-heading strong,
.appearance-heading small {
  display: block;
}

.appearance-heading strong {
  font-size: 11px;
}

.appearance-heading small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.theme-choice-group {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 1.4fr;
  gap: 4px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.theme-choice {
  min-height: 36px;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  transition:
    color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.theme-choice:hover {
  color: var(--ink);
}

.theme-choice.active {
  color: var(--accent-ink);
  background: var(--honey);
  box-shadow: 0 2px 6px rgba(25, 26, 21, 0.1);
}

.session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.session-footer > span {
  min-width: 0;
}

.session-footer strong,
.session-footer small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-footer strong {
  font-size: 11px;
}

.session-footer small {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
}

.logout-button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--danger);
}

.logout-button svg {
  width: 15px;
  height: 15px;
}

.proxy-settings {
  margin-top: 22px;
  padding: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.proxy-settings-heading,
.proxy-settings-heading > span,
.proxy-option-copy,
.proxy-test-copy {
  min-width: 0;
}

.proxy-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.proxy-settings-heading strong,
.proxy-settings-heading small {
  display: block;
}

.proxy-settings-heading strong {
  font-size: 11px;
}

.proxy-settings-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.proxy-ping-button {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 9px;
  font-weight: 750;
}

.proxy-ping-button i {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 14%, transparent);
}

.proxy-ping-button:disabled i {
  background: var(--honey-strong);
  animation: proxy-pulse 900ms ease-in-out infinite alternate;
}

@keyframes proxy-pulse {
  to {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

.proxy-route {
  display: grid;
  grid-template-columns: auto minmax(18px, 1fr) minmax(86px, auto) minmax(18px, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
}

.proxy-route > i {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 4px, transparent 4px 7px);
}

.proxy-route-node {
  min-width: 0;
  padding: 6px 8px;
  overflow: hidden;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--utility);
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-route-node.active {
  color: var(--accent-ink);
  background: var(--honey-soft);
  border-color: var(--honey-strong);
}

.proxy-options {
  display: grid;
  gap: 6px;
  margin-top: 13px;
}

.proxy-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 45px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.proxy-option.active {
  border-color: var(--honey-strong);
  box-shadow: inset 3px 0 0 var(--honey-strong);
}

.proxy-option-choice {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  cursor: pointer;
}

.proxy-option-choice input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.proxy-option-choice input:checked {
  background: var(--surface);
  border: 5px solid var(--honey-strong);
}

.proxy-option-copy strong,
.proxy-option-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-option-copy strong {
  font-family: var(--utility);
  font-size: 9px;
}

.proxy-option-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.proxy-delete-button {
  height: 28px;
  margin-right: 8px;
  padding: 0 8px;
  color: var(--danger);
  background: transparent;
  border-radius: 7px;
  font-size: 8px;
  font-weight: 700;
}

.proxy-delete-button:hover {
  background: var(--danger-soft);
}

.proxy-add-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 9px;
}

.proxy-add-line input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  outline: 0;
  font-family: var(--utility);
  font-size: 10px;
}

.proxy-add-line input:focus {
  border-color: var(--honey-strong);
  border-style: solid;
}

.proxy-note {
  display: block;
  margin: 6px 2px 0;
  color: var(--quiet);
  font-size: 8px;
}

.proxy-test-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.proxy-test-result[hidden] {
  display: none;
}

.proxy-test-result.loading {
  display: block;
  padding: 10px 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 9px;
}

.proxy-test-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.proxy-test-card > i {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
}

.proxy-test-card.warning > i {
  background: #d99a16;
}

.proxy-test-card.error > i {
  background: var(--danger);
}

.proxy-test-copy strong,
.proxy-test-copy small {
  display: block;
}

.proxy-test-copy strong {
  font-size: 9px;
}

.proxy-test-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.proxy-test-card > b {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 8px;
  white-space: nowrap;
}

.security-box {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding: 13px;
  background: var(--surface-warm);
  border: 1px solid #eadfba;
  border-radius: 13px;
}

.security-box > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: #8c7000;
}

.security-box strong,
.security-box small {
  display: block;
}

.security-box strong {
  font-size: 11px;
}

.security-box small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.security-box code {
  font-family: var(--utility);
  font-size: 9px;
}

.modal-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 9px;
  align-items: center;
  margin-top: 29px;
}

.secondary-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-weight: 650;
}

.secondary-button:hover {
  background: var(--paper);
}

.danger-text-button {
  padding: 9px 3px;
  color: var(--danger);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: flex;
  max-width: min(380px, calc(100% - 44px));
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 12px 15px;
  color: var(--surface);
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 12px 34px rgba(20, 20, 14, 0.22);
  animation: toast-in 170ms ease-out;
}

.toast.error {
  background: #7e302a;
}

@keyframes toast-in {
  from {
    transform: translateY(7px);
    opacity: 0;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .speaker-control > span {
    display: none;
  }

  .speaker-option {
    min-width: 65px;
    padding: 0 9px;
  }

  .chat-header {
    padding-right: 18px;
    padding-left: 18px;
  }

  .message-feed,
  .composer-wrap {
    padding-right: 24px;
    padding-left: 24px;
  }

  .message-stack {
    width: min(650px, 88%);
  }
}

@media (max-width: 720px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  .app-shell {
    display: block;
  }

  .connection-banner {
    top: max(7px, env(safe-area-inset-top));
    width: calc(100vw - 20px);
    justify-content: space-between;
  }

  .connection-banner strong {
    font-size: 10px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, calc(100% - 48px));
    border-right: 0;
    box-shadow: 18px 0 55px rgba(20, 20, 14, 0.17);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 19;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(25, 26, 21, 0.35);
  }

  .sidebar-open .sidebar-scrim {
    display: block;
  }

  .mobile-menu-button {
    display: grid;
  }

  .dialogue-view {
    grid-template-rows: minmax(0, 1fr) 58px minmax(0, 1fr);
  }

  .dialogue-side-inner {
    padding: 7px 9px 8px;
  }

  .dialogue-side-header {
    min-height: 32px;
    padding-bottom: 5px;
  }

  .dialogue-person-mark {
    width: 29px;
    height: 29px;
    border-radius: 9px 3px 9px 9px;
    font-size: 10px;
  }

  .dialogue-side-header strong {
    font-size: 12px;
  }

  .dialogue-side-header small,
  .dialogue-turn-status {
    font-size: 7px;
  }

  .dialogue-feed {
    padding: 2px 2px 6px;
  }

  .dialogue-empty-symbol {
    width: 38px;
    height: 38px;
    margin-bottom: 7px;
    border-radius: 12px 4px 12px 12px;
    font-size: 10px;
  }

  .dialogue-empty strong {
    font-size: 13px;
  }

  .dialogue-empty p {
    max-width: 300px;
    margin-top: 4px;
    font-size: 8px;
  }

  .dialogue-turn {
    width: 94%;
    margin-bottom: 9px;
    padding: 8px 9px 9px;
  }

  .dialogue-turn > header {
    margin-bottom: 5px;
  }

  .dialogue-turn-primary p {
    font-size: clamp(12px, 1.8vh, 15px);
  }

  .dialogue-turn-translation {
    margin-top: 5px;
    padding-top: 5px;
  }

  .dialogue-turn-translation p {
    font-size: clamp(9px, 1.3vh, 12px);
  }

  .dialogue-composer {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 4px;
    border-radius: 13px;
  }

  .dialogue-voice-button {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 11px 4px 11px 11px;
  }

  .dialogue-voice-button span {
    display: none;
  }

  .dialogue-text-field textarea {
    min-height: 40px;
    max-height: 58px;
    padding: 8px 5px 5px;
  }

  .dialogue-send-button {
    width: 38px;
    height: 38px;
  }

  .dialogue-axis {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    padding: 6px 9px;
  }

  .dialogue-axis-name {
    display: none;
  }

  .dialogue-menu-button {
    display: grid;
    width: 36px;
    height: 36px;
    margin: 0;
    background: rgba(255, 255, 255, 0.52);
    border-color: rgba(25, 26, 21, 0.15);
  }

  .dialogue-language-field {
    justify-self: stretch;
  }

  .dialogue-language-field select {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding-right: 23px;
  }

  .dialogue-clear-button {
    width: 36px;
    height: 36px;
  }

  .empty-menu {
    position: absolute;
    top: 18px;
    left: 18px;
  }

  .chat-header {
    grid-template-columns: auto auto minmax(0, 1fr);
    min-height: 72px;
    padding: 10px 13px;
  }

  .supplier-avatar {
    width: 42px;
    height: 42px;
    border-radius: 13px 5px 13px 13px;
  }

  .speaker-control {
    grid-column: 1 / -1;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .speaker-control > span {
    display: block;
  }

  .segmented {
    flex: 1;
  }

  .speaker-option {
    flex: 1;
  }

  .supplier-heading strong {
    max-width: calc(100vw - 170px);
  }

  .supplier-heading > svg {
    opacity: 1;
  }

  .message-feed {
    padding: 27px 13px 35px;
  }

  .message-history-state {
    margin-top: -10px;
  }

  .message-stack {
    width: 92%;
  }

  .original-bubble {
    font-size: 13px;
  }

  .translation-card {
    margin-right: 8px;
    margin-left: 8px;
  }

  .composer-wrap {
    padding: 9px 10px 11px;
  }

  .composer-hint span:first-child {
    display: none;
  }

  .composer-hint {
    justify-content: flex-end;
  }

  .empty-state {
    width: calc(100% - 34px);
  }

  .empty-state h1 {
    font-size: clamp(34px, 12vw, 49px);
  }

  .empty-visual {
    min-height: 132px;
    margin-bottom: 21px;
  }

  .empty-bubble {
    padding: 13px 15px;
    font-size: 12px;
  }

  .modal-card {
    padding: 27px 20px 21px;
    border-radius: 20px;
  }

  .auth-screen {
    min-height: 520px;
    padding: 14px;
  }

  .auth-card {
    padding: 27px 20px 23px;
    border-radius: 21px;
    box-shadow: 0 18px 48px rgba(31, 31, 20, 0.12);
    backdrop-filter: none;
  }

  .auth-card h1 {
    font-size: 31px;
  }

  .auth-atmosphere {
    display: none;
  }

  .chat-header,
  .modal::backdrop {
    backdrop-filter: none;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-password-field {
    grid-column: auto;
  }

  .openai-share-choice,
  .add-user-button {
    grid-column: auto;
    grid-row: auto;
  }

  .add-user-button {
    margin-top: 11px;
  }

  .user-actions {
    padding-left: 0;
  }

  .session-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .appearance-settings {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .server-load-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .statistics-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .statistics-range {
    grid-template-columns: repeat(4, 1fr);
  }

  .statistics-range button {
    padding: 0 5px;
  }

  .statistics-download {
    justify-content: center;
  }

  .proxy-test-result {
    grid-template-columns: 1fr;
  }

  .statistics-overview {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .statistics-primary {
    grid-template-columns: auto 1fr;
    column-gap: 11px;
    align-items: end;
  }

  .statistics-primary small {
    grid-column: 1 / -1;
  }

  .statistics-primary strong {
    font-size: 42px;
  }

  .statistics-primary span {
    margin-bottom: 4px;
  }

  .statistics-split {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .activity-chart {
    gap: 2px;
  }

  .activity-chart.compact {
    gap: 4px;
  }

  .language-row {
    grid-template-columns: minmax(115px, 1.25fr) minmax(55px, 0.8fr) 28px;
  }

  .logout-button {
    width: 100%;
    justify-content: center;
  }

  .modal-actions {
    grid-template-columns: 1fr 1fr;
  }

  .modal-actions > span {
    display: none;
  }

  .modal-actions .danger-text-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .settings-actions .danger-text-button {
    grid-column: 1 / -1;
  }
}

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

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151610;
  --surface: #1d1f18;
  --surface-warm: #252419;
  --honey: #f0ce45;
  --honey-strong: #d8b735;
  --honey-soft: #353019;
  --ink: #f2f0e7;
  --muted: #aaa99e;
  --quiet: #77796f;
  --line: #303229;
  --line-strong: #44463a;
  --danger: #e78378;
  --danger-soft: #341e1b;
  --success: #70be82;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

:root[data-theme="dark"] .auth-screen {
  background:
    linear-gradient(rgba(21, 22, 16, 0.87), rgba(21, 22, 16, 0.97)),
    radial-gradient(circle at 1px 1px, #3d3e32 1px, transparent 1.2px);
}

:root[data-theme="dark"] .auth-screen::before {
  opacity: 0.16;
}

:root[data-theme="dark"] .auth-card {
  background: rgba(29, 31, 24, 0.96);
  border-color: rgba(68, 70, 58, 0.9);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

:root[data-theme="dark"] .auth-atmosphere {
  color: rgba(242, 240, 231, 0.12);
}

:root[data-theme="dark"] .search-field {
  background: rgba(29, 31, 24, 0.72);
}

:root[data-theme="dark"] .chat-row:hover,
:root[data-theme="dark"] .settings-button:hover {
  background: rgba(255, 255, 255, 0.035);
}

:root[data-theme="dark"] .chat-row.active {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

:root[data-theme="dark"] .chat-view {
  background:
    linear-gradient(rgba(29, 31, 24, 0.94), rgba(29, 31, 24, 0.94)),
    radial-gradient(circle at 1px 1px, #44463a 1px, transparent 1.2px);
}

:root[data-theme="dark"] .dialogue-view {
  background:
    linear-gradient(rgba(21, 22, 16, 0.94), rgba(21, 22, 16, 0.94)),
    radial-gradient(circle at 1px 1px, #3d3e32 1px, transparent 1.2px);
}

:root[data-theme="dark"] .chat-header {
  background: rgba(29, 31, 24, 0.92);
}

:root[data-theme="dark"] .composer-wrap {
  background: linear-gradient(to bottom, rgba(29, 31, 24, 0), var(--surface) 24%);
}

:root[data-theme="dark"] .modal-card {
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .translation-card,
:root[data-theme="dark"] .add-user-box,
:root[data-theme="dark"] .openai-share-choice,
:root[data-theme="dark"] .member-profile-card,
:root[data-theme="dark"] .security-box,
:root[data-theme="dark"] .proxy-settings,
:root[data-theme="dark"] .server-load-panel {
  border-color: #4a4329;
}

:root[data-theme="dark"] .chat-avatar,
:root[data-theme="dark"] .supplier-avatar,
:root[data-theme="dark"] .user-avatar,
:root[data-theme="dark"] .profile-avatar {
  border-color: #5b512c;
}

:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .translation-label,
:root[data-theme="dark"] .security-box > svg {
  color: #dcc45b;
}

:root[data-theme="dark"] .author-chip {
  color: #ead678;
}

:root[data-theme="dark"] .translation-card.error,
:root[data-theme="dark"] .login-error {
  border-color: #683d38;
}

:root[data-theme="dark"] .error-row,
:root[data-theme="dark"] .login-error {
  color: #f0a097;
}

:root[data-theme="dark"] .role-badge {
  color: #9ed3aa;
  background: #203628;
}

:root[data-theme="dark"] .role-badge.owner {
  color: #ead678;
  background: var(--honey-soft);
}

.brand-mark,
.new-chat-button,
.primary-button,
.empty-bubble.source,
.speaker-option.active,
.mine .original-bubble,
.send-button,
.add-user-plus {
  color: var(--accent-ink);
}
