:root {
  --bg: #080c14;
  --bg-card: rgba(17, 24, 39, 0.78);
  --bg-card-solid: #111827;
  --bg-input: #0d1320;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  top: -160px;
  left: -120px;
  background: #6366f1;
}

.bg-glow-2 {
  bottom: -180px;
  right: -120px;
  background: #06b6d4;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.28);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.875rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.brand-title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-size: 0.84rem;
  font-weight: 600;
}

.user-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 0.98rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7275f7, #5b52f0);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.32);
}

.btn-success:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-strong);
}

.btn-danger-ghost {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
  color: #fca5a5;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.18);
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.32);
}

/* Landing Hero */
.hero-card {
  text-align: center;
  padding: 46px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  backdrop-filter: blur(18px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.32);
  color: #c7d2fe;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #818cf8;
}

.hero-card h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.hero-card h1 span {
  background: linear-gradient(90deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 650px;
  margin: 0 auto 28px;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.hero-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  text-align: left;
}

.feature-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Dashboard */
.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.dash-header h2 {
  margin: 0 0 4px;
  font-size: 1.55rem;
}

.dash-header p {
  margin: 0;
}

.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 118px;
}

.stat-label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.stat-chip strong {
  font-size: 1.15rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 270px;
  border: 2px dashed rgba(99, 102, 241, 0.42);
  background: rgba(17, 24, 39, 0.58);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.dropzone.drag-over {
  border-color: #22d3ee;
  background: rgba(34, 211, 238, 0.08);
  transform: scale(1.01);
}

.dropzone-icon {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  margin-bottom: 14px;
}

.dropzone h3 {
  margin: 0 0 6px;
}

.dropzone p {
  margin: 0 0 18px;
}

.progress-wrap {
  width: 100%;
  max-width: 420px;
  margin-top: 18px;
  text-align: left;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  transition: width 0.12s linear;
}

/* Mask Setup Card */
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 1.05rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.form-group label,
.key-gate-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.label-inline {
  font-size: 0.9rem;
  font-weight: 600;
}

.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input.mono {
  font-family: "JetBrains Mono", monospace;
}

.input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.input-lg {
  padding: 13px 16px;
  font-size: 1rem;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.chip-btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
}

.chip-btn:hover {
  border-color: #818cf8;
  color: #fff;
}

.mask-preview-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* Files Table */
.files-card {
  padding: 20px 24px;
}

.files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.files-header h3 {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.files-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.files-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: middle;
}

.files-table tr:last-child td {
  border-bottom: none;
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
}

.file-ext-pill {
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-mask {
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.32);
  color: #67e8f9;
  font-family: "JetBrains Mono", monospace;
}

.badge-warn {
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.badge-open {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.badge-lock {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: #fcd34d;
  margin-bottom: 8px;
}

.text-right {
  text-align: right;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}

/* Customer Share View */
.share-gate-card {
  max-width: 560px;
  margin: 34px auto;
  padding: 32px;
}

.center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px 0;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.status-error {
  background: var(--danger-bg);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.share-file-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.file-badge-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.share-file-text {
  min-width: 0;
  flex: 1;
}

.share-file-text h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.share-file-text p {
  margin: 0;
}

.key-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-input-row {
  display: flex;
  gap: 10px;
}

.key-input-row .input {
  flex: 1;
}

.unlocked-box {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unlocked-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.unlocked-banner p {
  margin: 2px 0 0;
}

.check-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.16s ease-out;
}

.modal-lg {
  max-width: 540px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.icon-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.icon-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

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

.modal-file-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0 12px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.error-text {
  color: #fca5a5;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

.shake {
  animation: shake 0.34s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.45);
  background: #064e3b;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: #7f1d1d;
}

@media (max-width: 860px) {
  .feature-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .key-input-row {
    flex-direction: column;
  }

  .navbar {
    padding: 12px 16px;
  }
}

/* Landing Hero Extras */
.gradient-text {
  background: linear-gradient(90deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Admin Toolbar: Tabs + Language Switcher */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.18));
  border-color: rgba(99, 102, 241, 0.45);
  color: #fff;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-pills {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Chat Management Layout */
.chat-admin-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  min-height: 560px;
}

.chat-rooms-sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 14px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-top h3 {
  margin: 0;
  font-size: 1rem;
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 500px;
}

.room-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.room-item:hover {
  border-color: var(--border-strong);
  background: rgba(30, 41, 59, 0.65);
}

.room-item.active {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.16);
}

.room-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.room-item-title {
  font-weight: 600;
  font-size: 0.94rem;
}

.room-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chat-workspace {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  min-height: 560px;
  max-height: 680px;
}

.chat-active-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
}

.chat-room-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.chat-room-title-wrap {
  min-width: 0;
  flex: 1;
}

.chat-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-title-line h3 {
  margin: 0;
  font-size: 1.15rem;
}

.chat-room-title-wrap p {
  margin: 4px 0 0;
}

.chat-room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 280px;
  max-height: 460px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.chat-msg-admin {
  align-self: flex-start;
}

.chat-msg-customer {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.sender-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
}

.sender-tag-admin {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}

.sender-tag-customer {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.chat-bubble {
  position: relative;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  line-height: 1.55;
  word-break: break-word;
}

.chat-msg-admin .chat-bubble {
  border-color: rgba(99, 102, 241, 0.34);
  background: rgba(30, 41, 59, 0.78);
}

.chat-msg-customer .chat-bubble {
  border-color: rgba(16, 185, 129, 0.34);
  background: rgba(6, 78, 59, 0.45);
}

.chat-text {
  white-space: pre-wrap;
  font-size: 0.94rem;
}

.chat-img-wrap {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-img-preview {
  max-width: 340px;
  max-height: 260px;
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.chat-att-card {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(8, 12, 20, 0.65);
  border: 1px solid var(--border-strong);
}

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

.chat-msg-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.chat-msg-del:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
}

.chat-staged-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.32);
  margin-top: 6px;
}

.staged-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.chat-composer .input {
  flex: 1;
}

.customer-chat-shell {
  max-width: 820px;
  margin: 10px auto;
  display: flex;
  flex-direction: column;
  min-height: 540px;
}

@media (max-width: 860px) {
  .chat-admin-layout {
    grid-template-columns: 1fr;
  }

  .hide-sm {
    display: none;
  }
}
