.totem-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

.totem-shell::before,
.totem-shell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.totem-shell::before {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 103, 255, 0.2) 0%, rgba(15, 103, 255, 0) 70%);
}

.totem-shell::after {
  width: 300px;
  height: 300px;
  left: -120px;
  bottom: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 184, 217, 0.18) 0%, rgba(0, 184, 217, 0) 72%);
}

.totem-top {
  position: sticky;
  top: 0;
  z-index: 24;
  padding: 0.92rem 0;
  backdrop-filter: blur(14px);
  background: rgba(239, 246, 255, 0.76);
  border-bottom: 1px solid var(--border);
}

.totem-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.totem-brand-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.totem-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(15, 86, 196, 0.2);
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  box-shadow: var(--shadow-sm);
}

.totem-logo-placeholder {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary-strong);
}

.totem-title {
  min-width: 0;
}

.totem-title h1 {
  margin: 0.28rem 0 0;
  font-size: clamp(1.26rem, 2.2vw, 1.64rem);
}

.totem-title p {
  margin: 0.18rem 0 0;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.totem-actions {
  justify-content: flex-end;
}

.totem-actions .btn {
  min-width: 156px;
}

.totem-main {
  flex: 1;
  padding: 1.12rem 0 1.72rem;
}

.totem-hero {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(15, 97, 217, 0.14);
  padding: 1.1rem;
  margin-bottom: 1rem;
  background:
    radial-gradient(560px 260px at 20% -10%, rgba(8, 108, 255, 0.18), transparent 72%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.9) 0%, rgba(242, 249, 255, 0.78) 100%);
  box-shadow: var(--shadow-sm);
}

.totem-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
}

.totem-hero-title {
  max-width: 780px;
}

.totem-hero-title h2 {
  margin: 0.42rem 0 0;
  font-size: clamp(1.22rem, 2.3vw, 1.72rem);
}

.totem-hero-title p {
  margin: 0.46rem 0 0;
  color: var(--text-soft);
  max-width: 60ch;
}

.totem-main-grid {
  display: grid;
  gap: 1rem;
}

.totem-home .totem-main-grid {
  min-height: calc(100dvh - 180px);
  align-content: start;
}

.totem-home .totem-menu-panel {
  border-radius: 28px;
}

.totem-home .totem-menu-panel .card-body {
  padding-top: 0.25rem;
}

.totem-menu-panel {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.totem-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.82rem;
}

.totem-menu-btn {
  min-height: 144px;
  border-radius: 24px;
  border: 1px solid rgba(16, 89, 198, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(236, 246, 255, 0.94) 100%);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.44rem;
  padding: 1rem 0.8rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition-fast);
  box-shadow: 0 14px 28px rgba(8, 49, 123, 0.12);
}

.totem-menu-btn:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 22px 44px rgba(5, 43, 115, 0.2);
  border-color: rgba(10, 102, 228, 0.34);
}

.totem-menu-btn .icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ecf4ff 0%, #dcecff 100%);
  color: var(--primary-strong);
  font-weight: 800;
  font-size: 1.1rem;
}

.totem-menu-btn strong {
  font-size: 0.95rem;
}

.totem-menu-btn small {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.78rem;
}

.totem-section-title {
  margin: 0;
  font-size: 1.12rem;
}

.totem-section-sub {
  margin: 0.36rem 0 0;
}

.quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.36rem 0.66rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--primary-strong);
  border: 1px solid rgba(12, 102, 222, 0.2);
  background: rgba(255, 255, 255, 0.78);
}

.chat-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.voice-mode .chat-layout {
  display: none;
}

.chat-shell {
  border-radius: var(--radius-xl);
  padding: 0.95rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.74rem;
  min-height: calc(100dvh - 214px);
}

.chat-shell .chips {
  padding: 0.1rem 0.1rem 0.28rem;
}

.chat-list {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(245, 251, 255, 0.86) 100%);
  padding: 0.92rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.chat-bubble {
  max-width: min(88%, 560px);
  border-radius: 16px;
  padding: 0.7rem 0.82rem;
  font-size: 0.94rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-bubble.user {
  margin-left: auto;
  background: linear-gradient(180deg, rgba(15, 103, 255, 0.2) 0%, rgba(15, 103, 255, 0.12) 100%);
  border: 1px solid rgba(15, 103, 255, 0.25);
}

.chat-bubble.assistant {
  margin-right: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  border: 1px solid rgba(16, 89, 198, 0.15);
}

.chat-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.52rem;
}

.voice-transcript {
  margin-top: 0.25rem;
  font-size: 0.86rem;
  min-height: 1.2rem;
  color: var(--text-soft);
}

.voice-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(900px 460px at 10% 0%, rgba(15, 103, 255, 0.22), transparent 72%),
    radial-gradient(820px 500px at 90% 100%, rgba(0, 184, 217, 0.18), transparent 68%),
    rgba(7, 21, 48, 0.44);
  backdrop-filter: blur(7px);
  overflow: hidden;
}

.voice-modal.open {
  display: flex;
  animation: fadeInVoice 220ms ease-out;
}

.voice-modal-card {
  width: min(920px, 96vw);
  max-height: calc(100dvh - 2rem);
  border-radius: 30px;
  border: 1px solid rgba(129, 186, 255, 0.42);
  background:
    radial-gradient(620px 280px at 10% -12%, rgba(15, 103, 255, 0.22), transparent 74%),
    linear-gradient(168deg, rgba(255, 255, 255, 0.96) 0%, rgba(236, 246, 255, 0.92) 100%);
  box-shadow: var(--shadow-lg);
  padding: 1.18rem;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.92rem;
  overflow: hidden;
}

.voice-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.85rem;
}

.voice-modal-head h2 {
  margin: 0.42rem 0 0;
  font-size: clamp(1.22rem, 2vw, 1.56rem);
}

.voice-modal-head p {
  margin: 0.42rem 0 0;
  color: var(--text-soft);
}

.voice-state {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(13, 94, 214, 0.22);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-soft);
  padding: 0.52rem 0.82rem;
  font-weight: 700;
}

.voice-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8ea2c3;
}

.voice-state.is-listening {
  color: #0b8657;
  border-color: rgba(8, 162, 104, 0.34);
  background: rgba(225, 255, 241, 0.86);
}

.voice-state.is-listening .voice-dot {
  background: #0ba16a;
  box-shadow: 0 0 0 0 rgba(11, 161, 106, 0.48);
  animation: pulseClient 1.1s ease-out infinite;
}

.voice-state.is-processing {
  color: #1154c8;
  border-color: rgba(17, 84, 200, 0.34);
  background: rgba(226, 240, 255, 0.88);
}

.voice-state.is-processing .voice-dot {
  background: #1154c8;
  animation: pulseProcessing 0.95s linear infinite;
}

.voice-state.is-speaking {
  color: #c5223f;
  border-color: rgba(197, 34, 63, 0.36);
  background: rgba(255, 232, 238, 0.9);
}

.voice-state.is-speaking .voice-dot {
  background: #d6284a;
  box-shadow: 0 0 0 0 rgba(214, 40, 74, 0.44);
  animation: pulseAssistant 0.9s ease-out infinite;
}

.voice-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.78rem;
  min-height: 0;
}

.voice-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-radius: 20px;
  border: 1px solid rgba(16, 89, 198, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(244, 250, 255, 0.92) 100%);
  padding: 0.88rem;
}

.voice-panel h3 {
  margin: 0;
  font-size: 0.92rem;
}

.voice-panel p {
  margin: 0.5rem 0 0;
  color: var(--text-soft);
  min-height: 0;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-y: auto;
  word-break: break-word;
  padding-right: 0.18rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 84, 200, 0.35) rgba(17, 84, 200, 0.08);
}

.voice-panel p::-webkit-scrollbar {
  width: 6px;
}

.voice-panel p::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(17, 84, 200, 0.35);
}

.voice-panel p::-webkit-scrollbar-track {
  background: rgba(17, 84, 200, 0.08);
}

.voice-modal-actions {
  display: flex;
  gap: 0.58rem;
  flex-wrap: wrap;
}

.chat-side {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.chat-side .card {
  border-radius: 22px;
}

.side-kpi {
  display: grid;
  gap: 0.6rem;
}

.side-kpi-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f9ff 100%);
  padding: 0.66rem 0.72rem;
}

.side-kpi-item strong {
  display: block;
  font-size: 1rem;
}

.catalog-layout {
  display: grid;
  gap: 1rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.88rem;
}

.catalog-card {
  border-radius: 22px;
  border: 1px solid rgba(16, 89, 198, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
  padding: 0.92rem;
  display: grid;
  gap: 0.6rem;
  box-shadow: var(--shadow-xs);
  min-height: 218px;
}

.catalog-card-media {
  width: 100%;
  height: 148px;
  border-radius: 16px;
  border: 1px solid rgba(16, 89, 198, 0.14);
  background: linear-gradient(180deg, #ecf5ff 0%, #ddebff 100%);
  overflow: hidden;
}

.catalog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-card-media.empty {
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.catalog-card h4 {
  margin: 0;
  font-size: 1.02rem;
}

.catalog-card p {
  margin: 0;
  color: var(--text-soft);
}

.catalog-card .toolbar {
  margin-top: auto;
}

.catalog-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.75rem;
  font-weight: 700;
}

.catalog-ai-box {
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(360px 180px at 15% -20%, rgba(0, 184, 217, 0.2), transparent 70%),
    linear-gradient(165deg, #ffffff 0%, #edf5ff 100%);
  box-shadow: var(--shadow-sm);
}

.catalog-ai-answer {
  margin: 0;
  color: var(--text-soft);
  white-space: pre-wrap;
}

.catalog-modal {
  z-index: 150;
  background: rgba(7, 23, 52, 0.58);
  backdrop-filter: blur(7px);
}

.catalog-modal-box {
  width: min(860px, 94vw) !important;
  border-radius: 24px !important;
  border: 1px solid rgba(126, 183, 255, 0.28);
  background:
    radial-gradient(520px 240px at -10% -20%, rgba(15, 103, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #edf6ff 100%);
  box-shadow: 0 26px 66px rgba(7, 33, 92, 0.3);
}

.catalog-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.catalog-modal-head h3 {
  margin: 0.45rem 0 0;
  font-size: clamp(1.15rem, 2vw, 1.48rem);
}

.catalog-modal-body {
  display: grid;
  gap: 0.78rem;
}

.catalog-modal-image-wrap {
  border-radius: 18px;
  border: 1px solid rgba(16, 89, 198, 0.18);
  background: linear-gradient(180deg, #f3f9ff 0%, #e3f0ff 100%);
  overflow: hidden;
  min-height: 250px;
}

.catalog-modal-image-wrap img {
  width: 100%;
  height: min(50vh, 420px);
  object-fit: contain;
  background: linear-gradient(180deg, #edf5ff 0%, #deebff 100%);
}

.catalog-modal-no-image {
  min-height: 250px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-weight: 700;
  padding: 1rem;
  text-align: center;
}

.detail-shell {
  min-height: 100dvh;
  padding: 1.08rem 0 1.84rem;
}

.detail-wrap {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.detail-card {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(15, 96, 214, 0.18);
  background:
    radial-gradient(500px 220px at 12% -16%, rgba(15, 103, 255, 0.18), transparent 72%),
    linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  box-shadow: var(--shadow-sm);
  padding: 1.16rem;
}

.detail-card h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.3vw, 1.82rem);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.58rem;
  margin-top: 1rem;
}

.kiosk-action {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 50;
  width: auto;
}

@media (max-width: 1200px) {
  .totem-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .totem-brand {
    flex-direction: column;
    align-items: stretch;
  }

  .totem-actions {
    width: 100%;
  }

  .totem-actions .btn {
    min-width: 0;
  }

  .totem-hero-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .voice-modal {
    padding: 0.65rem;
  }

  .totem-top {
    position: static;
  }

  .totem-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .totem-title h1 {
    font-size: 1.24rem;
  }

  .totem-main {
    padding-top: 0.82rem;
    padding-bottom: 1.44rem;
  }

  .totem-home .totem-main-grid {
    min-height: auto;
  }

  .totem-hero {
    padding: 0.88rem;
  }

  .totem-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.68rem;
  }

  .totem-menu-btn {
    min-height: 124px;
    border-radius: 20px;
    padding: 0.84rem 0.64rem;
  }

  .totem-menu-btn .icon {
    width: 46px;
    height: 46px;
    font-size: 1rem;
  }

  .chat-shell {
    min-height: 66dvh;
    padding: 0.78rem;
  }

  .chat-controls {
    grid-template-columns: 1fr;
  }

  .voice-modal-card {
    width: calc(100vw - 1.3rem);
    max-height: calc(100dvh - 1.3rem);
    padding: 0.88rem;
    border-radius: 24px;
    gap: 0.7rem;
  }

  .voice-modal-head {
    flex-direction: column;
  }

  .voice-modal-head p {
    font-size: 0.96rem;
  }

  .voice-panels {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .voice-modal-actions .btn {
    width: 100%;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .catalog-modal-box {
    width: 96vw !important;
    padding: 0.82rem !important;
  }

  .catalog-modal-head {
    flex-direction: column;
  }

  .catalog-modal-image-wrap {
    min-height: 190px;
  }

  .catalog-modal-image-wrap img {
    height: min(40vh, 290px);
  }

  .detail-card {
    padding: 0.92rem;
  }

  .kiosk-action {
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    width: auto;
  }
}

@keyframes fadeInVoice {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseClient {
  0% {
    box-shadow: 0 0 0 0 rgba(11, 161, 106, 0.48);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(11, 161, 106, 0);
  }
}

@keyframes pulseAssistant {
  0% {
    box-shadow: 0 0 0 0 rgba(214, 40, 74, 0.44);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(214, 40, 74, 0);
  }
}

@keyframes pulseProcessing {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
}
