:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --ink: #211a14;
  --muted: #796c5f;
  --line: #eadfd1;
  --accent: #ff6f0f;
  --accent-dark: #d95f0d;
  --green: #1f8f5f;
  --shadow: 0 24px 70px rgba(74, 48, 23, 0.14);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 111, 15, 0.18), transparent 28rem),
    linear-gradient(180deg, #fff7ed 0%, var(--bg) 42%, #f3eee7 100%);
  color: var(--ink);
  font-family:
    "Pretendard",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    sans-serif;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.hero {
  padding: 28px min(5vw, 64px) 72px;
}

.topbar,
.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 7px 7px 11px 11px;
  background: var(--accent);
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.1);
  transform: rotate(-12deg);
}

.login-link,
.primary-action,
.chat-action,
.qr-card button,
.qr-frame-fallback button,
.qr-dialog-footer button,
.rooms-actions button,
.chat-dialog-footer button,
.search-form button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.login-link {
  padding: 11px 17px;
  background: #1f1a16;
  color: white;
  box-shadow: 0 12px 28px rgba(31, 26, 22, 0.18);
}

.login-user {
  display: grid;
  justify-items: end;
  gap: 3px;
  padding: 9px 15px;
  border: 1px solid rgba(31, 143, 95, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(31, 143, 95, 0.12);
}

.login-user[hidden] {
  display: none;
}

.login-user span {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
}

.login-user strong {
  font-size: 0.96rem;
  line-height: 1;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 111, 15, 0.18), transparent 26rem),
    linear-gradient(135deg, #fff8ed 0%, #f3eee7 100%);
}

.auth-gate[hidden] {
  display: none;
}

body.auth-pending {
  overflow: hidden;
}

body.auth-pending .app-topbar,
body.auth-pending .workspace {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 111, 15, 0.16);
  border-radius: var(--radius-xl);
  background: rgba(255, 250, 243, 0.94);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.auth-brand h1 {
  margin: 4px 0 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  letter-spacing: -0.05em;
}

.auth-copy {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.app-login-form {
  display: grid;
  gap: 14px;
}

.app-login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.app-login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 15px;
  background: #fffdf9;
  color: var(--ink);
  outline: none;
}

.app-login-form input:focus {
  border-color: rgba(255, 111, 15, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 111, 15, 0.11);
}

.app-login-form button {
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(255, 111, 15, 0.22);
}

.app-login-form button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-status[data-state="error"] {
  color: #b3261e;
}

.app-user {
  display: grid;
  justify-items: end;
  gap: 3px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 111, 15, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.app-user[hidden] {
  display: none;
}

.app-user span {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.app-user strong {
  font-size: 0.96rem;
  line-height: 1;
}

.logout-link[hidden] {
  display: none;
}

.hero-copy {
  width: min(790px, 100%);
  margin: 92px auto 0;
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 9px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.45rem, 7vw, 5.7rem);
  line-height: 0.96;
  letter-spacing: -0.08em;
}

.hero-copy p:last-child {
  width: min(650px, 100%);
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.shell {
  margin-top: -40px;
  padding: 0 min(5vw, 64px) 56px;
}

.panel,
.status-card {
  border: 1px solid rgba(234, 223, 209, 0.9);
  background: rgba(255, 250, 243, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  border-radius: var(--radius-xl);
  padding: clamp(20px, 4vw, 34px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  letter-spacing: -0.05em;
}

.pill,
.status-text {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff3e6;
  color: var(--accent-dark);
  font-weight: 800;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(230px, 1.35fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  padding: 0 14px;
}

select:focus,
input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 111, 15, 0.28);
  outline-offset: 2px;
}

.search-form button {
  min-height: 48px;
  padding: 0 24px;
  background: var(--accent);
  color: white;
  box-shadow: 0 13px 28px rgba(255, 111, 15, 0.26);
}

.search-form button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.quick-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff7ee;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 800;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.status-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.status-card strong,
.status-card a {
  display: inline-block;
  margin-top: 8px;
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.qr-card a {
  color: var(--green);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.qr-card button {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  background: transparent;
  color: var(--green);
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.qr-card button[hidden],
.qr-card strong[hidden] {
  display: none;
}

.qr-card strong {
  color: var(--green);
}

.qr-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.results.empty {
  display: block;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 1.2rem;
}

.search-progress-card {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid rgba(255, 111, 15, 0.18);
  border-radius: 22px;
  background: rgba(255, 250, 243, 0.92);
  box-shadow: 0 18px 48px rgba(255, 111, 15, 0.12);
}

.search-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.search-progress-top strong {
  font-size: 1.05rem;
}

.search-progress-top span {
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.search-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1e5d8;
}

.search-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff9b4d);
  transition: width 220ms ease;
}

.search-progress-card p,
.search-progress-card small {
  margin: 0;
  color: var(--muted);
}

.search-progress-card p {
  font-weight: 800;
}

.empty-state.compact {
  min-height: 132px;
}

.rooms-panel {
  margin-bottom: 18px;
}

.rooms-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rooms-actions button {
  padding: 10px 14px;
  background: #1f1a16;
  color: white;
  box-shadow: 0 12px 26px rgba(31, 26, 22, 0.15);
}

.rooms-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.chat-rooms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chat-rooms.empty {
  display: block;
}

.room-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  padding: 12px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(74, 48, 23, 0.1);
}

.room-thumb {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 111, 15, 0.14), rgba(31, 143, 95, 0.1)),
    #f4eadf;
  background-position: center;
  background-size: cover;
  color: #9b8978;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.room-thumb.has-image span {
  display: none;
}

.room-body {
  min-width: 0;
}

.room-title-row,
.room-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-title {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-time,
.room-product {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.room-message {
  display: -webkit-box;
  min-height: 40px;
  margin: 7px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.room-product {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-unread {
  min-width: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
}

.article-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.article-card:hover,
.login-link:hover,
.primary-action:hover,
.chat-action:hover,
.search-form button:not(:disabled):hover {
  transform: translateY(-2px);
}

.article-card:hover {
  box-shadow: 0 18px 40px rgba(74, 48, 23, 0.12);
}

.article-image {
  display: grid;
  min-height: 158px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 111, 15, 0.12), rgba(31, 143, 95, 0.08)),
    #f4eadf;
  background-position: center;
  background-size: cover;
  color: #9b8978;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.article-image.has-image span {
  display: none;
}

.article-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.article-meta,
.article-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-badge {
  border-radius: 999px;
  background: #fff1e2;
  color: var(--accent-dark);
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.article-price {
  color: #3527d9;
  font-weight: 900;
}

.article-body h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.article-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.article-actions {
  margin-top: auto;
  justify-content: flex-start;
}

.primary-action,
.chat-action {
  padding: 9px 13px;
  font-size: 0.88rem;
}

.primary-action {
  background: var(--accent);
  color: white;
}

.chat-action {
  border: 1px solid var(--line);
  background: #fff7ee;
  color: var(--accent-dark);
}

.modal-open {
  overflow: hidden;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.qr-modal.is-open {
  display: flex;
}

.qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 26, 20, 0.48);
  backdrop-filter: blur(6px);
}

.qr-dialog {
  position: relative;
  width: min(360px, 100%);
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: 0 28px 70px rgba(33, 26, 20, 0.28);
}

.qr-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: #ff8126;
  color: white;
}

.qr-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qr-carrot {
  width: 24px;
  height: 24px;
  border-radius: 8px 8px 12px 12px;
  background: #fff4e7;
  transform: rotate(-24deg);
}

.qr-dialog h2,
.qr-dialog p {
  margin: 0;
}

.qr-dialog h2 {
  font-size: 1rem;
  line-height: 1.25;
}

.qr-dialog p {
  opacity: 0.9;
  font-size: 0.78rem;
  font-weight: 800;
}

.qr-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.qr-frame-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 306px;
  padding: 28px;
  background: #fff;
}

.qr-frame-wrap > img {
  width: 220px;
  height: 220px;
  padding: 12px;
  border: 1px solid #ffc08c;
  border-radius: 12px;
  background: white;
  object-fit: contain;
}

.qr-frame-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  width: 220px;
  height: 220px;
  padding: 18px;
  border: 1px solid #ffc08c;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.qr-frame-fallback[hidden],
.qr-frame-wrap > img[hidden] {
  display: none;
}

.qr-frame-fallback strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.qr-frame-fallback span {
  font-size: 0.82rem;
  line-height: 1.45;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #f1eee9;
  border-top-color: #6f73ff;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.qr-dialog-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  background: #fffaf3;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.qr-dialog-footer span {
  flex: 1 1 100%;
}

.qr-dialog-footer button {
  padding: 10px 14px;
  background: var(--accent);
  color: white;
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.chat-modal.is-open {
  display: flex;
}

.chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 24, 0.46);
  backdrop-filter: blur(5px);
}

.chat-dialog {
  position: relative;
  width: min(384px, 100%);
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(33, 26, 20, 0.28);
}

.chat-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  background: linear-gradient(135deg, #ff7a1a, #ff8d2c);
  color: white;
}

.chat-dialog-header h2 {
  margin: 0;
  font-size: 0.98rem;
}

.chat-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.chat-dialog-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.chat-product-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.45;
}

.chat-dialog textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1.5px solid #6f73ff;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  outline: none;
}

.chat-dialog textarea:focus {
  box-shadow: 0 0 0 3px rgba(111, 115, 255, 0.16);
}

.chat-send-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.chat-dialog-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 18px;
}

.chat-cancel,
.chat-send {
  min-height: 38px;
  padding: 0 16px;
}

.chat-cancel {
  background: #f1f2f4;
  color: #4c535c;
}

.chat-send {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(255, 111, 15, 0.22);
}

.chat-send:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .search-form,
  .status-grid,
  .chat-rooms,
  .results {
    grid-template-columns: 1fr;
  }

  .article-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .topbar,
  .panel-heading,
  .rooms-actions,
  .article-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    padding-top: 20px;
  }

  .hero-copy {
    margin-top: 58px;
    text-align: left;
  }

  .article-card {
    grid-template-columns: 1fr;
  }

  .article-image {
    min-height: 210px;
  }
}

/* Workspace layout */
body {
  min-height: 100vh;
  background: #f5f7fb;
  color: #1f2933;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #e7ebf2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.topbar {
  width: 100%;
  max-width: none;
  padding: 14px 22px;
}

.brand small {
  margin-left: 8px;
  color: #f28b45;
  font-size: 0.72rem;
  font-weight: 900;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eefaf5;
  color: #16855a;
  font-size: 0.78rem;
  font-weight: 900;
}

body.security-locked .ws-pill {
  background: #fff1f2;
  color: #be123c;
}

body.security-locked .conversation-panel,
body.security-locked .qr-card {
  outline: 2px solid rgba(225, 29, 72, 0.16);
}

.login-link {
  padding: 9px 14px;
  background: #ffffff;
  color: var(--green);
  border: 1px solid #e8edf5;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

.login-user {
  padding: 7px 12px;
  border-color: #e3ebf4;
  background: #fff;
  box-shadow: none;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(360px, 1fr) minmax(380px, 0.95fr);
  gap: 20px;
  width: 100%;
  min-height: calc(100vh - 62px);
  padding: 22px;
}

.mobile-tabbar {
  display: none;
}

.panel,
.status-card {
  border: 1px solid #e6ebf2;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.07);
  backdrop-filter: none;
}

.panel {
  border-radius: 20px;
  padding: 18px;
}

.search-panel,
.conversation-panel {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 106px);
  overflow: auto;
}

.section-kicker {
  color: var(--accent);
  letter-spacing: 0.16em;
}

.panel h2 {
  font-size: 1.28rem;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

select,
input,
.active-chat-form textarea {
  min-height: 46px;
  border: 1px solid #dde5ef;
  border-radius: 14px;
  background: #f8fafc;
}

.search-form button {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.region-picker {
  display: grid;
  gap: 10px;
}

.region-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.region-picker-header span small {
  margin-left: 8px;
  color: #6f63ff;
  font-size: 0.72rem;
  font-weight: 900;
}

.region-picker-header button {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e84d6a;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 900;
}

.region-options {
  display: grid;
  max-height: 230px;
  overflow: auto;
  border: 1px solid #dde5ef;
  border-radius: 14px;
  background: #fff;
}

.region-option,
.region-option-empty {
  padding: 10px 12px;
}

.region-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #eef2f7;
  color: #344054;
  cursor: pointer;
  font-size: 0.88rem;
}

.region-option:last-child {
  border-bottom: 0;
}

.region-option input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.region-option:has(input:checked) {
  background: #fff7ef;
  color: #211a14;
  font-weight: 800;
}

.region-option-empty {
  margin: 0;
  color: #9aa4b2;
  font-size: 0.84rem;
}

.quick-row button {
  background: #f6f8fb;
}

.status-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.status-card {
  border-radius: 16px;
  padding: 15px;
}

.qr-card button {
  font-size: 1rem;
}

.results-panel {
  min-height: calc(100vh - 106px);
}

.result-toolbar {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.result-toolbar strong {
  color: #4f46e5;
  font-size: 0.9rem;
}

.results {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.article-card {
  display: block;
  border-radius: 18px;
}

.article-image {
  min-height: 150px;
}

.article-body {
  padding: 14px;
}

.article-meta {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.article-price {
  color: var(--accent);
}

.article-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-action,
.chat-action {
  text-align: center;
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(120px, 0.45fr) minmax(360px, 1fr);
  gap: 12px;
}

.conversation-panel[data-chat-view="rooms"] {
  grid-template-rows: auto 1fr;
}

.conversation-panel[data-chat-view="active"] {
  grid-template-rows: auto 1fr;
}

.conversation-panel[data-chat-view="rooms"] .active-chat {
  display: none;
}

.conversation-panel[data-chat-view="active"] .chat-rooms {
  display: none;
}

.chat-heading {
  align-items: center;
  margin-bottom: 0;
}

.back-chat-list {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff7ef;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
}

.back-chat-list[hidden] {
  display: none;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #f6f8fb;
  color: #667085;
  cursor: pointer;
  font-weight: 900;
}

.chat-rooms {
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: auto;
}

.room-card {
  width: 100%;
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.room-card:focus-visible {
  outline: 3px solid rgba(255, 111, 15, 0.28);
  outline-offset: 2px;
}

.room-thumb {
  width: 54px;
  height: 54px;
  border-radius: 14px;
}

.room-message {
  min-height: auto;
  margin: 5px 0;
  -webkit-line-clamp: 1;
}

.active-chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid #e6ebf2;
  border-radius: 18px;
  background: #fff;
}

.conversation-panel[data-chat-view="active"] .active-chat {
  min-height: calc(100vh - 190px);
}

.active-chat-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-bottom: 1px solid #edf1f6;
}

.chat-product-thumb {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: #eef1f6;
  color: #9aa4b2;
  font-size: 0.68rem;
  font-weight: 900;
}

.active-chat-product strong,
.active-chat-product small {
  display: block;
}

.active-chat-product small {
  margin-top: 3px;
  color: #7b8794;
  font-size: 0.8rem;
}

.active-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 18px;
  background: #fbfcfe;
}

.chat-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 220px;
  color: #8b95a1;
  text-align: center;
}

.chat-placeholder strong {
  color: #4b5563;
}

.chat-bubble {
  max-width: 78%;
  align-self: flex-start;
}

.chat-bubble p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 5px;
  background: #eef1f6;
  color: #2f3a45;
  line-height: 1.45;
}

.chat-bubble span {
  display: block;
  margin-top: 4px;
  color: #9aa4b2;
  font-size: 0.72rem;
}

.chat-bubble.mine {
  align-self: flex-end;
  text-align: right;
}

.chat-bubble.mine p {
  border-radius: 16px 16px 5px 16px;
  background: var(--accent);
  color: white;
}

.active-chat-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.active-chat-form textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: 12px;
  font: inherit;
  outline: none;
}

.active-chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-chat-footer span {
  color: #7b8794;
  font-size: 0.8rem;
}

.active-chat-footer button {
  min-width: 84px;
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.active-chat-footer button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.search-form label span small {
  float: right;
  color: #6f63ff;
  font-size: 0.72rem;
  font-weight: 900;
}

.selected-region-list {
  display: grid;
  max-height: 190px;
  overflow: auto;
  border: 1px solid #e4ebf4;
  border-radius: 14px;
  background: #fff;
}

.selected-region-empty {
  margin: 0;
  padding: 14px;
  color: #9aa4b2;
  font-size: 0.84rem;
}

.selected-region-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  color: #344054;
  cursor: pointer;
  font-size: 0.86rem;
}

.selected-region-item:last-child {
  border-bottom: 0;
}

.selected-region-item input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.selected-region-item small {
  color: #a0a9b5;
  font-size: 0.72rem;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.chat-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fa-expand::before {
  content: "⛶";
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
}

.workspace,
.search-panel,
.results-panel,
.conversation-panel {
  transition:
    grid-template-columns 220ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

body.search-maximized .workspace {
  grid-template-columns: 1fr;
}

body.search-maximized .search-panel,
body.search-maximized .conversation-panel {
  display: none;
}

body.search-maximized .results-panel {
  min-height: calc(100vh - 106px);
}

body.chat-maximized .workspace {
  grid-template-columns: 1fr;
}

body.chat-maximized .search-panel,
body.chat-maximized .results-panel {
  display: none;
}

body.chat-maximized .conversation-panel {
  position: static;
  max-height: none;
  min-height: calc(100vh - 106px);
}

body.chat-maximized .active-chat {
  min-height: calc(100vh - 300px);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 280px minmax(360px, 1fr);
  }

  .conversation-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  body.auth-pending {
    padding-bottom: 0;
  }

  .app-topbar {
    z-index: 40;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 10px 14px 8px;
  }

  .brand {
    min-width: 0;
  }

  .brand span:not(.brand-mark) {
    font-size: 1rem;
    white-space: nowrap;
  }

  .brand small {
    margin-left: 4px;
    font-size: 0.62rem;
  }

  .topbar-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .app-user {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
  }

  .login-user {
    grid-column: 1 / -1;
    justify-items: stretch;
  }

  .ws-pill {
    display: none;
  }

  .login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom));
  }

  .search-panel,
  .results-panel,
  .conversation-panel {
    display: none;
    position: static;
    max-height: none;
    overflow: visible;
    padding: 16px;
    border-radius: 22px;
  }

  body.mobile-view-search .search-panel,
  body.mobile-view-results .results-panel {
    display: block;
  }

  body.mobile-view-chat-rooms .conversation-panel,
  body.mobile-view-chat-active .conversation-panel {
    display: grid;
  }

  .results-panel {
    min-height: calc(100vh - 210px);
  }

  .conversation-panel {
    grid-template-rows: auto 1fr;
  }

  .conversation-panel[data-chat-view="active"] .active-chat {
    min-height: calc(100vh - 230px);
  }

  .region-options {
    max-height: 42vh;
  }

  .panel-heading {
    align-items: flex-start;
    gap: 12px;
  }

  .result-toolbar,
  .chat-heading-actions {
    width: 100%;
  }

  .chat-heading-actions {
    justify-content: flex-end;
  }

  .article-image {
    min-height: 190px;
  }

  .mobile-tabbar {
    position: fixed;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 7px;
    border: 1px solid rgba(221, 229, 239, 0.92);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(31, 41, 51, 0.22);
    backdrop-filter: blur(14px);
  }

  body.auth-pending .mobile-tabbar {
    display: none;
  }

  .mobile-tabbar button {
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #667085;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .mobile-tabbar button[aria-pressed="true"] {
    background: #fff4e9;
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px rgba(255, 111, 15, 0.14);
  }
}
