/* Luxury Shop Dark Theme Styles */

:root {
  --dark-bg: #1a1a1a;
  --dark-bg-secondary: #2a2a2a;
  --neon-green: #39ff14;
  --neon-green-hover: #2ee00a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --card-shadow-hover: 0 8px 30px rgba(57, 255, 20, 0.2);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-bg-hover: rgba(255, 255, 255, 0.09);
  --focus-ring: rgba(57, 255, 20, 0.35);
}

/* Global Styles */
body {
  background-color: var(--dark-bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* Ensure common Tailwind text colors don't turn everything gray on dark */
.text-gray-600 { color: var(--text-secondary) !important; }
.text-gray-700, .text-gray-900 { color: var(--text-primary) !important; }

/* Listings top bar (title + found + sorting) */
.listings-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.listings-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}

.listings-found {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.listings-found-count {
  color: var(--text-primary);
  font-weight: 600;
}

.listings-sort-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.listings-sort-wrap {
  margin-top: 0.25rem;
}

.listings-toolbar {
  margin-bottom: 0.9rem;
}

/* Dark form controls */
.lux-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.lux-input,
.lux-select {
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.lux-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.lux-input:hover,
.lux-select:hover {
  background: var(--input-bg-hover);
}

.lux-input:focus,
.lux-select:focus {
  border-color: rgba(57, 255, 20, 0.6);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.lux-select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.75) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

/* Filters sidebar card */
.filters-card {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(6px);
}

.filters-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.filters-card-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.filters-reset {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}

.filters-reset:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.filters-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.filters-mobile-toggle {
  display: none;
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.filters-mobile-toggle-icon {
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.filters-mobile-toggle[aria-expanded="true"] .filters-mobile-toggle-icon {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .listings-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .listings-toolbar {
    margin-bottom: 0.6rem;
  }

  .listings-sort-wrap {
    width: 100%;
    margin-top: 0;
  }

  .listings-sort-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .listings-sort-label {
    margin-bottom: 0.1rem;
  }
}

/* Navbar Styles */
.navbar {
  background-color: var(--dark-bg);
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.navbar-logo {
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
}

.logo-z {
  color: var(--neon-green);
  font-weight: 700;
  font-size: 1.8rem;
}

.logo-text {
  color: var(--text-primary);
}

.navbar-links {
  display: flex;
  gap: 2rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--neon-green);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.user-label {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.user-label:hover {
  background-color: rgba(57, 255, 20, 0.1);
  color: var(--neon-green);
}

.btn-primary {
  background-color: var(--neon-green);
  color: var(--dark-bg);
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background-color: var(--neon-green-hover);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.price-display-switcher {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.price-display-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.price-display-select {
  width: auto;
  min-width: 7.5rem;
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.price-display-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.locale-switcher {
  display: flex;
  gap: 0.5rem;
}

.locale-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 0.2s, color 0.2s;
}

.locale-link:hover,
.locale-link.active {
  background-color: var(--dark-bg-secondary);
  color: var(--text-primary);
}

/* Hero Section */
.hero-section {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
  margin-bottom: 4rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%),
              url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 500"><rect fill="%231a1a1a" width="1200" height="500"/><path d="M0,250 Q300,200 600,250 T1200,250" stroke="%2339ff14" stroke-width="2" fill="none" opacity="0.3"/></svg>');
  background-size: cover;
  background-position: center;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(26, 26, 26, 0.8), rgba(26, 26, 26, 0.4));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10%;
}

.hero-title {
  font-size: 6rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

/* Latest in Stock Section */
.latest-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.section-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.latest-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.latest-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Featured Card */
.featured-card {
  background-color: var(--dark-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}

.featured-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.featured-image-container {
  width: 100%;
  height: 400px;
  overflow: hidden;
  position: relative;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-info {
  background-color: rgba(57, 255, 20, 0.15);
  padding: 1.5rem;
}

.featured-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.featured-price {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.featured-btn {
  background-color: var(--neon-green);
  color: var(--dark-bg);
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
}

.featured-btn:hover {
  background-color: var(--neon-green-hover);
}

/* Product Card */
.product-card {
  background-color: var(--dark-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.product-image-container {
  width: 100%;
  height: 230px;
  overflow: hidden;
  background-color: var(--dark-bg);
}

.product-image-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-favorite-form {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 4;
  margin: 0;
}

.product-favorite-btn {
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.96);
  color: #3b3b3b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, color 0.15s ease;
}

.product-favorite-btn:hover {
  transform: translateY(-1px);
  color: #ef4444;
}

.product-favorite-btn.is-active {
  color: #ef4444;
}

.product-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.55rem;
  text-decoration: none;
  line-height: 1.2;
}

.product-title:hover {
  color: var(--neon-green);
}

.product-price {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.product-price--accent {
  font-size: 1.8rem;
  font-weight: 800;
  color: #25c766;
  letter-spacing: 0.01em;
}

.product-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.75rem;
}

.product-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.product-meta-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-meta-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 700;
}

.product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.product-time {
  white-space: nowrap;
}

.product-card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Product Grid */
.products-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.category-filters {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.category-filter {
  color: var(--text-primary);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.9rem;
  font-weight: 500;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.category-filter:hover,
.category-filter.active {
  color: var(--neon-green);
  border-bottom-color: var(--neon-green);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Profile Page */
.profile-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.profile-header {
  margin-bottom: 3rem;
}

.profile-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.profile-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.favorites-section {
  margin-top: 3rem;
}

.favorites-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.empty-state {
  background-color: var(--dark-bg-secondary);
  border-radius: 12px;
  padding: 4rem 2rem;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.empty-state-text {
  color: var(--text-secondary);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.empty-state-btn {
  background-color: var(--neon-green);
  color: var(--dark-bg);
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s;
}

.empty-state-btn:hover {
  background-color: var(--neon-green-hover);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .latest-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 4rem;
  }

  .navbar-container {
    flex-wrap: wrap;
  }

  .navbar-links {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 3rem;
  }

  .section-title {
    font-size: 2rem;
  }

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

  .category-filters {
    gap: 1rem;
  }

  .navbar-container {
    padding: 0 1rem;
  }

  .navbar {
    padding: 0.7rem 0;
  }

  .navbar-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .navbar-logo {
    align-self: flex-start;
  }

  .navbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: stretch;
  }

  .navbar-actions > .btn-primary,
  .navbar-actions > .btn-secondary,
  .navbar-actions > .nav-link,
  .navbar-actions > .user-label,
  .navbar-actions > form {
    width: 100%;
    text-align: center;
    margin: 0;
  }

  .navbar-actions form button,
  .navbar-actions form input[type="submit"] {
    width: 100%;
  }

  .price-display-switcher,
  .locale-switcher {
    grid-column: 1 / -1;
  }

  .price-display-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .price-display-label {
    font-size: 0.72rem;
  }

  .price-display-select {
    width: 100%;
    min-width: 0;
  }

  .locale-switcher {
    justify-content: space-between;
  }

  .locale-link {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.4rem;
  }

  .chat-tray {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .chat-tray-panel {
    width: min(100vw - 1rem, 24rem);
    height: min(75vh, 30rem);
  }

  .chat-tray-fab {
    width: 3rem;
    height: 3rem;
    font-size: 1.2rem;
  }

  .product-image-container {
    height: 220px;
  }

  .product-info {
    padding: 1rem;
  }

  .product-favorite-form {
    right: 0.55rem;
    bottom: 0.55rem;
  }

  .product-favorite-btn {
    width: 2.6rem;
    height: 2.6rem;
  }

  .product-price--accent {
    font-size: 1.65rem;
  }

  .product-meta-grid {
    gap: 0.4rem 0.6rem;
  }

  .product-meta-item {
    font-size: 0.88rem;
  }

  .featured-image-container {
    height: 260px;
  }

  .featured-info {
    padding: 1rem;
  }

  .flash-messages {
    padding: 0.75rem 1rem;
  }

  .filters-mobile-toggle {
    display: flex;
    margin-top: 0.15rem;
    margin-bottom: 0.9rem;
  }

  .filters-card {
    position: static !important;
    top: auto !important;
    margin-bottom: 0.75rem;
  }

  .filters-mobile-collapsed {
    display: none;
  }
}

@media (max-width: 480px) {
  .logo-link {
    font-size: 1.25rem;
  }

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

  .btn-primary,
  .btn-secondary {
    padding: 0.55rem 0.95rem;
    font-size: 0.9rem;
  }

  .listings-title {
    font-size: 1.35rem;
  }

  .listings-found {
    font-size: 0.85rem;
  }

  .product-image-container {
    height: 205px;
  }

  .product-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chat-tray-panel {
    width: calc(100vw - 0.5rem);
    height: min(78vh, 31rem);
    border-radius: 0.75rem;
  }

  .chat-message-bubble {
    max-width: 96%;
  }
}

/* Flash Messages */
.flash-messages {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

.flash-notice {
  background-color: rgba(57, 255, 20, 0.2);
  border-left: 4px solid var(--neon-green);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.flash-alert {
  background-color: rgba(255, 0, 0, 0.2);
  border-left: 4px solid #ff0000;
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Pagination Styles */
.pagy-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.pagy-nav .page {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-primary);
  background-color: var(--dark-bg-secondary);
  transition: background-color 0.2s, color 0.2s;
}

.pagy-nav .page:hover {
  background-color: rgba(57, 255, 20, 0.2);
  color: var(--neon-green);
}

.pagy-nav .page.active {
  background-color: var(--neon-green);
  color: var(--dark-bg);
  font-weight: 600;
}

.pagy-nav .page.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.pagy-nav .page.prev,
.pagy-nav .page.next {
  background-color: transparent;
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
}

.pagy-nav .page.prev:hover,
.pagy-nav .page.next:hover {
  background-color: var(--neon-green);
  color: var(--dark-bg);
}

/* Floating chat tray */
.chat-tray-fab-wrap {
  position: relative;
}

.chat-tray-fab-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.chat-tray-fab-badge.chat-tray-fab-badge--empty {
  display: none;
}

.chat-contact-unread-cell {
  flex-shrink: 0;
  min-width: 1.35rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.chat-tray {
  position: fixed;
  z-index: 10050;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
}

.chat-tray > turbo-cable-stream-source {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.chat-tray > * {
  pointer-events: auto;
}

.chat-tray-fab {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(145deg, rgba(57, 255, 20, 0.2), rgba(20, 40, 30, 0.95));
  color: var(--neon-green);
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-tray-fab:hover {
  transform: scale(1.05);
  box-shadow: var(--card-shadow-hover);
}

.chat-tray-panel {
  width: min(100vw - 2rem, 22rem);
  height: min(70vh, 28rem);
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 18, 18, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.chat-tray-panel.hidden {
  display: none;
}

.chat-tray-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
}

.chat-tray-panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-tray-panel-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.chat-tray-panel-close:hover {
  color: var(--text-primary);
}

.chat-tray-panel-body,
.chat-tray-turbo-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

turbo-frame.chat-tray-turbo-frame {
  flex: 1;
  min-height: 0;
}

.chat-tray-inner-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-tray-loading {
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Contact list (single column: tap to open thread) */
.chat-contact-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-contact-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.12s ease;
}

.chat-contact-row:hover {
  background: rgba(57, 255, 20, 0.08);
}

.chat-contact-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(57, 255, 20, 0.15);
  border: 1px solid rgba(57, 255, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-green);
}

.chat-contact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.chat-contact-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.chat-contact-listing {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-contact-unread {
  flex-shrink: 0;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
}

.chat-inbox-empty {
  padding: 1rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
}

.chat-open-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-back-link {
  display: block;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: var(--neon-green);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-back-link:hover {
  text-decoration: underline;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
}

.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-message {
  display: flex;
  justify-content: flex-start;
}

.chat-message--mine {
  justify-content: flex-end;
}

.chat-message-bubble {
  max-width: 92%;
  border-radius: 0.75rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
}

.chat-message--mine .chat-message-bubble {
  background: rgba(57, 255, 20, 0.12);
  border-color: rgba(57, 255, 20, 0.35);
}

.chat-message-author {
  display: block;
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.chat-message-body {
  font-size: 0.82rem;
  color: var(--text-primary);
  word-break: break-word;
}

.chat-message-body p {
  margin: 0.15rem 0;
}

.chat-message-time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  color: var(--text-secondary);
  opacity: 0.85;
}

.chat-compose-form {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.4rem;
}

.chat-compose-errors {
  color: #ffb4b4;
  font-size: 0.75rem;
  margin: 0 0 0.35rem 1rem;
  padding: 0;
}

.chat-compose-row {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
}

.chat-compose-input {
  flex: 1;
  resize: none;
  border-radius: 0.65rem;
  border: 1px solid var(--border-subtle);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  min-height: 2.5rem;
}

.chat-compose-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.chat-compose-submit {
  border-radius: 0.65rem;
  border: 1px solid var(--neon-green);
  background: rgba(57, 255, 20, 0.18);
  color: var(--neon-green);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  white-space: nowrap;
}

.chat-compose-submit:hover {
  background: rgba(57, 255, 20, 0.28);
}
