:root {
  --ink: #17201d;
  --ink-soft: #53605b;
  --surface: #ffffff;
  --surface-soft: #f2f5f3;
  --surface-warm: #fbf7ef;
  --line: #dce3df;
  --line-strong: #c6d0cb;
  --night: #0b1714;
  --night-soft: #152723;
  --accent: #e76542;
  --accent-dark: #bd4629;
  --accent-soft: #fff0eb;
  --gold: #c39432;
  --success: #23845f;
  --success-soft: #e7f5ef;
  --warning: #a2690c;
  --warning-soft: #fff4d9;
  --danger: #bd3d38;
  --danger-soft: #fdecea;
  --info: #286d94;
  --info-soft: #e9f3f9;
  --shadow: 0 10px 28px rgba(15, 31, 26, 0.1);
  --radius: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--surface-soft);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--surface-soft);
  color: var(--ink);
}

body,
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
label[for] {
  touch-action: manipulation;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label[for]:focus-within {
  outline: 3px solid rgba(229, 101, 66, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.visually-hidden-input {
  position: fixed;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--night);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0 28%, transparent 28% 100%),
    var(--night);
}

.login-panel {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 28px 22px 20px;
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand h1 {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.18;
}

.login-intro {
  margin: 22px 0 24px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.login-form {
  display: grid;
}

.login-form .field-label + input,
.login-form .field-label + .password-field {
  margin-top: 7px;
}

.login-form input + .field-label,
.login-form .password-field + .field-label {
  margin-top: 18px;
}

.login-button {
  margin-top: 22px;
}

.form-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: #7f2421;
  font-size: 14px;
  line-height: 1.5;
}

.login-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 22px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface-soft);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(60px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(11, 23, 20, 0.97);
  color: #fff;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  font-size: 25px;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 17px;
  white-space: nowrap;
}

.brand-copy small {
  color: #9fb0aa;
  font-size: 11px;
  white-space: nowrap;
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  max-width: 46%;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #e8efec;
  font-size: 12px;
  cursor: pointer;
}

.connection-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot,
.status-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #98a29e;
}

.status-icon {
  width: 12px;
  height: 12px;
}

.status-dot.is-online,
.status-icon.is-online {
  background: #52c995;
  box-shadow: 0 0 0 3px rgba(82, 201, 149, 0.14);
}

.status-dot.is-warning,
.status-icon.is-warning {
  background: #e4aa3e;
  box-shadow: 0 0 0 3px rgba(228, 170, 62, 0.14);
}

.status-dot.is-offline,
.status-icon.is-offline {
  background: #e2635e;
  box-shadow: 0 0 0 3px rgba(226, 99, 94, 0.14);
}

.status-dot.is-checking,
.status-icon.is-checking {
  animation: status-pulse 1.3s ease-in-out infinite;
}

@keyframes status-pulse {
  50% { opacity: 0.35; }
}

.primary-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: calc(62px + var(--safe-bottom));
  padding: 5px 8px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -8px 24px rgba(15, 31, 26, 0.06);
  backdrop-filter: blur(16px);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  padding: 4px;
  background: transparent;
  color: #68726e;
  font-size: 11px;
  cursor: pointer;
}

.nav-item::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: transparent;
  content: "";
  transform: translateX(-50%);
}

.nav-item.is-active {
  color: var(--accent-dark);
  font-weight: 700;
}

.nav-item.is-active::before {
  background: var(--accent);
}

.nav-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.app-main {
  width: 100%;
  max-width: 960px;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  margin: 0 auto;
  padding-bottom: calc(76px + var(--safe-bottom));
  background: var(--surface);
}

.app-view {
  min-height: 100%;
}

.system-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #ecd99a;
  background: var(--warning-soft);
  color: #6c4a0e;
}

.system-banner.is-danger {
  border-color: #f0c1bd;
  background: var(--danger-soft);
  color: #7b2d29;
}

.system-banner.is-info {
  border-color: #c6dfed;
  background: var(--info-soft);
  color: #225b79;
}

.banner-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.banner-copy {
  min-width: 0;
}

.banner-copy strong {
  display: block;
  font-size: 13px;
}

.banner-copy p {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.text-button {
  min-height: 38px;
  padding: 6px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.camera-section,
.conversation-section {
  padding: 22px 16px;
}

.camera-section {
  border-bottom: 8px solid var(--surface-soft);
}

.section-heading,
.view-header,
.settings-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-heading {
  margin-bottom: 14px;
}

.eyebrow {
  display: block;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.section-heading h2,
.view-header h1,
.settings-section h2 {
  margin: 4px 0 0;
  line-height: 1.25;
}

.section-heading h2 {
  font-size: 19px;
}

.permission-label,
.config-badge,
.item-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.permission-label.is-granted,
.config-badge.is-ready,
.item-badge.is-success {
  background: var(--success-soft);
  color: #18664a;
}

.permission-label.is-denied,
.item-badge.is-failed {
  background: var(--danger-soft);
  color: #8b2f2b;
}

.item-badge.is-running {
  background: var(--info-soft);
  color: #225f80;
}

.item-badge.is-waiting {
  background: var(--warning-soft);
  color: #77500d;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 56vh;
  overflow: hidden;
  border-radius: var(--radius);
  background: #101b18;
}

.camera-stage video,
.camera-stage > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px;
  color: #eef5f2;
  text-align: center;
}

.camera-placeholder strong {
  font-size: 15px;
}

.camera-placeholder span:last-child {
  color: #9eb0a9;
  font-size: 12px;
}

.viewfinder {
  position: relative;
  display: block;
  width: 56px;
  height: 42px;
  margin-bottom: 6px;
  border: 2px solid #769087;
  border-radius: 5px;
}

.viewfinder::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.camera-live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(10, 18, 16, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.camera-live-badge::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #f46658;
  content: "";
}

.camera-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.send-button,
.record-button,
.audio-play-button,
.icon-button,
.danger-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 100ms ease;
}

.primary-button:active,
.secondary-button:active,
.send-button:active,
.record-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.primary-button,
.send-button {
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.send-button:hover {
  background: var(--accent-dark);
}

.primary-button.compact {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}

.secondary-button {
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.secondary-button:hover {
  border-color: #9faea7;
  background: var(--surface-soft);
}

.file-button {
  user-select: none;
}

.icon-button {
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
}

.icon-button.subtle {
  width: 36px;
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.primary-button:disabled,
.secondary-button:disabled,
.send-button:disabled,
.record-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.capture-button {
  flex: 1 1 110px;
}

.conversation-heading {
  align-items: center;
}

.conversation-log {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 120px;
  max-height: 48vh;
  padding: 2px 0 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 92%;
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--night-soft);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.user-message .message-avatar {
  background: var(--accent);
}

.message-body {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px 8px 8px 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.user-message .message-body {
  border-color: #f2c4b7;
  border-radius: 8px 3px 8px 8px;
  background: var(--accent-soft);
}

.message-body p {
  margin: 0;
  white-space: pre-wrap;
}

.message-body img {
  display: block;
  width: min(100%, 260px);
  max-height: 240px;
  margin-bottom: 8px;
  border-radius: 5px;
  object-fit: cover;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 11px;
}

.speak-answer-button {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}

.message.is-loading .message-body {
  min-width: 62px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #78837f;
  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%, 70%, 100% { transform: translateY(0); opacity: 0.4; }
  35% { transform: translateY(-4px); opacity: 1; }
}

.attachment-strip,
.audio-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin-bottom: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-warm);
}

.attachment-strip img {
  flex: 0 0 45px;
  width: 45px;
  height: 45px;
  border-radius: 4px;
  object-fit: cover;
}

.attachment-strip > div {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.attachment-strip strong {
  font-size: 13px;
}

.attachment-strip span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-play-button {
  flex: 0 0 38px;
  width: 38px;
  min-height: 38px;
  padding: 0 0 0 2px;
  background: var(--night-soft);
  color: #fff;
  font-size: 13px;
}

.audio-wave {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 3px;
  min-width: 50px;
  height: 30px;
}

.audio-wave i {
  flex: 1 1 auto;
  max-width: 5px;
  height: 10px;
  border-radius: 3px;
  background: #c49b64;
}

.audio-wave i:nth-child(2n) { height: 20px; }
.audio-wave i:nth-child(3n) { height: 14px; }

.audio-strip > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.composer {
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(15, 31, 26, 0.06);
}

.composer:focus-within {
  border-color: #d78d76;
  box-shadow: 0 0 0 3px rgba(229, 101, 66, 0.1);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 150px;
  padding: 8px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #87908c;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #edf0ee;
}

.record-button {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.record-button.is-recording {
  border-color: #e59894;
  background: var(--danger-soft);
  color: var(--danger);
}

.record-symbol {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.record-button.is-recording .record-symbol {
  border-radius: 2px;
  animation: record-pulse 1s ease-in-out infinite;
}

@keyframes record-pulse {
  50% { opacity: 0.45; }
}

.record-button time {
  font-variant-numeric: tabular-nums;
}

.composer-hint {
  flex: 1 1 auto;
  color: #818b87;
  font-size: 10px;
  line-height: 1.35;
}

.send-button {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 9px 12px;
  font-size: 13px;
}

.send-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  line-height: 1;
}

.view-header {
  align-items: center;
  padding: 24px 16px 18px;
  border-bottom: 1px solid var(--line);
}

.view-header h1 {
  font-size: 25px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-height: 39px;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}

.segmented-control button.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(15, 31, 26, 0.1);
}

.tab-panel {
  padding: 0 16px 24px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
}

.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.upload-progress {
  margin-top: 12px;
  padding: 12px;
  border-left: 3px solid var(--info);
  background: var(--info-soft);
}

.upload-progress div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.upload-progress progress,
.task-progress {
  width: 100%;
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #d6e1dc;
  accent-color: var(--info);
}

.item-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.file-icon,
.task-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 44px;
  place-items: center;
  border-radius: 5px;
  background: var(--surface-warm);
  color: #8c5e1a;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.task-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--info-soft);
  color: var(--info);
  font-size: 17px;
}

.list-item-main {
  min-width: 0;
}

.list-item-main strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-main p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.list-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 5px;
  color: #75807b;
  font-size: 11px;
}

.list-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.list-item-actions .icon-button {
  width: 34px;
  min-height: 34px;
  border-color: transparent;
  color: var(--ink-soft);
  font-size: 18px;
}

.task-item {
  align-items: start;
}

.task-item .list-item-main {
  padding-top: 2px;
}

.task-state-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.task-state-line span:last-child {
  color: var(--ink-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  padding: 54px 24px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 24px;
}

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

.empty-state p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 8px solid var(--surface-soft);
}

.task-summary div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 17px 8px;
  border-right: 1px solid var(--line);
}

.task-summary div:last-child {
  border-right: 0;
}

.task-summary strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.task-summary span {
  color: var(--ink-soft);
  font-size: 11px;
}

.task-list {
  padding: 4px 16px 24px;
}

.settings-section {
  padding: 20px 16px;
  border-bottom: 8px solid var(--surface-soft);
}

.settings-section h2 {
  font-size: 16px;
}

.settings-heading {
  margin-bottom: 16px;
}

.settings-heading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.status-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.status-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 57px;
  border-bottom: 1px solid var(--line);
}

.status-row div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.status-row strong {
  font-size: 13px;
}

.status-row span:last-child {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.permission-actions .secondary-button {
  min-width: 0;
}

.field-label {
  display: block;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="search"],
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.settings-section > .field-label + input,
.settings-section > .field-label + select,
.settings-section > .field-label + .password-field {
  margin-top: 7px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.password-field:focus-within {
  outline: 3px solid rgba(229, 101, 66, 0.18);
  outline-offset: 1px;
}

.password-field input {
  min-width: 0;
  border: 0;
  outline: 0;
}

.password-field .icon-button {
  margin-right: 3px;
}

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.switch-row > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.switch-row strong {
  font-size: 13px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 25px;
  border-radius: 13px;
  background: #b9c1bd;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked + .switch {
  background: var(--success);
}

.switch-row input:checked + .switch::after {
  transform: translateX(19px);
}

.switch-row input:focus-visible + .switch {
  outline: 3px solid rgba(35, 132, 95, 0.2);
  outline-offset: 2px;
}

.full-width {
  width: calc(100% - 32px);
  margin: 16px;
}

#settingsForm > .full-width {
  width: calc(100% - 32px);
  margin: 16px;
}

.about-section .full-width {
  width: 100%;
  margin: 14px 0 0;
}

.about-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.about-row strong {
  color: var(--ink);
  font-weight: 600;
}

.danger-text-button {
  padding: 9px 13px;
  border: 1px solid #e6bbb8;
  background: #fff;
  color: var(--danger);
  font-size: 13px;
}

.toast-region {
  position: fixed;
  right: 14px;
  bottom: calc(76px + var(--safe-bottom));
  left: 14px;
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  width: fit-content;
  max-width: min(100%, 520px);
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(15, 27, 23, 0.96);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.45;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  background: rgba(126, 39, 35, 0.97);
}

.toast.is-success {
  background: rgba(25, 102, 73, 0.97);
}

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

@media (max-width: 380px) {
  .camera-controls .secondary-button {
    flex: 1 1 120px;
  }

  .composer-hint {
    display: none;
  }

  .send-button {
    margin-left: auto;
  }

  .connection-pill {
    max-width: 42%;
  }
}

@media (min-width: 720px) {
  .camera-section,
  .conversation-section,
  .view-header,
  .tab-panel,
  .settings-section,
  .task-list {
    padding-right: 28px;
    padding-left: 28px;
  }

  .segmented-control {
    margin-right: 28px;
    margin-left: 28px;
  }

  #settingsForm > .full-width {
    width: calc(100% - 56px);
    margin-right: 28px;
    margin-left: 28px;
  }
}

@media (min-width: 900px) {
  body {
    background: #dfe5e2;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    max-width: 1220px;
    margin: 0 auto;
    box-shadow: 0 0 50px rgba(15, 31, 26, 0.12);
  }

  .app-header {
    position: sticky;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding: 24px 20px 18px;
    background: var(--night);
  }

  .connection-pill {
    position: absolute;
    top: 82px;
    right: 18px;
    left: 18px;
    max-width: none;
    justify-content: flex-start;
  }

  .primary-nav {
    position: sticky;
    top: 0;
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    padding: 58px 12px 20px;
    border: 0;
    background: var(--night);
    box-shadow: none;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #aab8b3;
    font-size: 13px;
  }

  .nav-item::before {
    top: 50%;
    left: 0;
    width: 3px;
    height: 24px;
    transform: translateY(-50%);
  }

  .nav-item.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .app-main {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding-bottom: 0;
  }

  #view-assistant {
    display: grid;
    grid-template-columns: minmax(340px, 0.92fr) minmax(390px, 1.08fr);
    align-content: start;
  }

  #view-assistant .system-banner {
    grid-column: 1 / -1;
  }

  .camera-section {
    min-height: calc(100vh - 1px);
    min-height: calc(100dvh - 1px);
    border-right: 8px solid var(--surface-soft);
    border-bottom: 0;
  }

  .conversation-section {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .conversation-log {
    flex: 1 1 auto;
    max-height: calc(100vh - 310px);
    max-height: calc(100dvh - 310px);
  }

  .toast-region {
    bottom: 24px;
    left: 234px;
  }
}

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