/* Global UI */
:root {
  --bg-start: #0f172a;
  --bg-end: #2d2f71;
  --card-bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.88);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #5b7bff;
  --accent-strong: #3c59d6;
  --accent-soft: #eef2ff;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 25px 80px rgba(15, 23, 42, 0.12);
  --sidebar-width: 280px;
  --content-max: 1200px;
  --content-pad-x: clamp(16px, 2.5vw, 36px);
  --bp-mobile: 767px;
  --bp-tablet: 1024px;
  --bp-laptop: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.24), transparent 28%),
              radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.18), transparent 30%),
              linear-gradient(180deg, #0b1127 0%, #1c2460 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.btn {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

.sidebar {
  background: rgba(15, 23, 42, 0.98);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  z-index: 15;
}

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

.sidebar .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5b7bff, #8b5cf6);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 20px 50px rgba(91, 123, 255, 0.25);
}

.sidebar .brand-info span {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.sidebar .brand-info small {
  color: #94a3b8;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav .nav-section {
  display: grid;
  gap: 4px;
}

.sidebar-nav .nav-subitems {
  display: grid;
  gap: 2px;
  margin: 0 0 4px 18px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-sublink {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(203, 213, 225, 0.88);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-sublink:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  color: rgba(226, 232, 240, 0.92);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.22);
}

.sidebar-nav .nav-link span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-footer p {
  font-size: 0.95rem;
  color: #94a3b8;
  line-height: 1.6;
}

.sidebar-footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.sidebar-footer-links a {
  color: rgba(203, 213, 225, 0.88);
  font-size: 0.85rem;
  line-height: 1.4;
  text-decoration: none;
}

.sidebar-footer-links a:hover {
  color: #fff;
}

.legal-doc h3 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 1.15rem;
}

.legal-doc .note-text {
  margin: 0;
}

.content-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--content-pad-x);
  gap: 16px;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  min-width: 0;
}

.topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-title h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: #f8fafc;
}

.topbar-title p {
  margin: 4px 0 0;
  color: #94a3b8;
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.topbar-user-name {
  pointer-events: none;
}

.topbar-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.18);
  white-space: nowrap;
}

.topbar-plan-free {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.22);
}

.topbar-plan-lite {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.24);
}

.topbar-plan-pro,
.topbar-plan-premium {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.24);
}

.menu-toggle {
  display: none;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  color: #fff;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #5b7bff, #7c3aed);
  color: #fff;
  box-shadow: 0 18px 35px rgba(91, 123, 255, 0.24);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.drop-zone {
  border: 1px dashed rgba(99, 102, 241, 0.55);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  color: #0f172a;
  background: rgba(59, 130, 246, 0.08);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
  cursor: pointer;
}

.drop-zone:hover {
  transform: translateY(-1px);
}

.drop-zone.dragover {
  background: rgba(59, 130, 246, 0.16);
  border-color: #5b7bff;
}

.upload-form {
  display: grid;
  gap: 18px;
}

.file-list {
  margin-top: 10px;
  color: #475569;
  line-height: 1.6;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.process-progress {
  display: none;
  margin-top: 12px;
  max-width: 320px;
}

.process-progress.is-visible {
  display: block;
}

.process-progress-label {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 600;
}

.process-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  overflow: hidden;
  border: 1px solid rgba(91, 123, 255, 0.22);
}

.process-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(135deg, #5b7bff, #7c3aed);
  transition: width 0.25s ease;
}

.process-progress-pct {
  margin: 8px 0 0;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
}

.process-progress.is-complete .process-progress-label {
  color: #15803d;
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.note-text {
  color: #94a3b8;
  font-size: 0.95rem;
}

.btn.google {
  background: #3b82f6;
  color: #fff;
}

.download-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-radius: 16px;
  padding: 12px 20px;
}

.download-btn:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.card-panel table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.card-panel th,
.card-panel td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.admin-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.08);
}

.filter-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row input[type='text'],
.filter-row input[type='date'],
.filter-row select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fafc;
}

.preview-image {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
}

.card-panel th {
  background: rgba(91, 123, 255, 0.12);
  color: #0f172a;
}

.card-panel tr:hover {
  background: rgba(99, 102, 241, 0.08);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 14px 18px;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  z-index: 50;
}

.main-content {
  padding: 28px var(--content-pad-x) 48px;
  display: grid;
  gap: 28px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  min-width: 0;
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.page-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.4rem);
  color: #fff;
}

.page-heading p {
  margin: 0;
  color: #cbd5e1;
  max-width: 720px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(91, 123, 255, 0.95), rgba(124, 58, 237, 0.9));
  padding: 36px;
  box-shadow: var(--shadow);
  color: #fff;
}

.hero-card::before,
.hero-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.hero-card::before {
  width: 200px;
  height: 200px;
  top: -60px;
  right: -60px;
  background: rgba(255, 255, 255, 0.18);
}

.hero-card::after {
  width: 260px;
  height: 260px;
  bottom: -80px;
  left: -40px;
  background: rgba(59, 130, 246, 0.16);
}

.hero-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: center;
}

.hero-copy h3 {
  margin: 0;
  font-size: clamp(2.6rem, 3vw, 3.2rem);
  line-height: 1.03;
}

.hero-copy p {
  margin: 20px 0 0;
  font-size: 1rem;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.9);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.hero-actions .btn {
  min-width: 160px;
}

.hero-metrics {
  display: grid;
  gap: 18px;
}

.metric-pill {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 20px;
  border-radius: 20px;
  min-height: 120px;
  display: grid;
  gap: 10px;
}

.metric-pill span {
  display: block;
  color: #c7d2fe;
  font-size: 0.95rem;
}

.metric-pill strong {
  font-size: 1.75rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-title h3 {
  margin: 0;
  color: #f8fafc;
}

.section-title p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.95rem;
}

.grid-4,
.grid-3,
.grid-2,
.grid-1 {
  display: grid;
  gap: 20px;
}

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

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

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

.card-panel,
.tool-card,
.upgrade-panel,
.activity-card {
  background: rgba(255,255,255,0.94);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.07);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 24px;
}

.card-panel h4,
.tool-card h4,
.upgrade-panel h4,
.activity-card h4 {
  margin: 0 0 10px;
}

.card-panel p,
.tool-card p,
.upgrade-panel p,
.activity-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.stat-card {
  padding: 24px 22px;
  background: rgba(255,255,255,0.96);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.stat-card span {
  color: #94a3b8;
  display: block;
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: 2rem;
  display: block;
  color: #0f172a;
}

.tool-card {
  position: relative;
  min-height: 220px;
}

.tool-card .tool-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-open {
  background: #fef3c7;
  color: #92400e;
}

.status-in-progress {
  background: #e0e7ff;
  color: #4338ca;
}

.status-waiting-for-user {
  background: #ede9fe;
  color: #6d28d9;
}

.status-resolved {
  background: #dcfce7;
  color: #166534;
}

.status-closed {
  background: #e2e8f0;
  color: #0f1720;
}

.status-user-responded {
  background: #fce7f3;
  color: #9d174d;
}

.ticket-panel {
  background: rgba(255,255,255,0.96);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 22px;
}

.ticket-panel h4 {
  margin: 0 0 14px;
  color: #0f172a;
}

.ticket-panel p {
  margin: 0;
  color: #475569;
  line-height: 1.8;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.timeline-item {
  padding: 18px;
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.timeline-item time {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #64748b;
}

.tool-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.12);
  color: #be185d;
  font-size: 0.82rem;
  font-weight: 700;
}

.tool-card h4 {
  margin: 18px 0 10px;
  font-size: 1.2rem;
}

.tool-card p {
  min-height: 60px;
}

.tool-card .tool-action {
  display: inline-flex;
  margin-top: 16px;
  align-items: center;
  gap: 8px;
  color: #2563eb;
  font-weight: 700;
}

.tool-card .tool-action:hover {
  color: #1d4ed8;
}

.tool-card .tool-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.tool-card .tool-action-premium {
  color: #7c3aed;
}

.tool-card .tool-action-premium:hover {
  color: #6d28d9;
}

.badge-premium {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
}

.premium-banner {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #f5f3ff;
  border: 1px solid rgba(124, 58, 237, 0.18);
}

.premium-banner p {
  margin: 0;
  color: #4c1d95;
}

.activity-card {
  display: grid;
  gap: 18px;
}

.activity-row {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.activity-row strong {
  font-size: 1rem;
  color: #0f172a;
}

.activity-row small {
  color: #64748b;
}

.upgrade-panel {
  padding: 28px;
}

.upgrade-panel ul {
  margin: 18px 0 0;
  padding-left: 20px;
  color: #475569;
}

.upgrade-panel li {
  margin-bottom: 12px;
}

@media (max-width: 1440px) {
  :root {
    --content-max: 1120px;
  }
}

/* Tablet + mobile (<1024): off-canvas / collapsible sidebar */
@media (max-width: 1023px) {
  :root {
    --content-max: 960px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), 86vw);
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: none;
    max-height: 100dvh;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 60px rgba(15, 23, 42, 0.22);
  }

  .app-shell.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 20;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    border-radius: 0;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-actions {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  .main-content {
    padding: 24px var(--content-pad-x) 40px;
  }
}

@media (max-width: 900px) {
  .hero-row,
  .stats-grid,
  .tool-grid,
  .grid-4,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .hero-card {
    padding: 28px 22px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  :root {
    --content-max: 100%;
    --content-pad-x: 16px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-user {
    align-items: flex-start;
  }

  .hero-copy h3 {
    font-size: 2rem;
  }

  .sidebar-nav .nav-link {
    padding: 12px 14px;
  }

  .upload-form .btn,
  .action-group .btn,
  .auth-card .btn {
    width: 100%;
  }
}

/* Large desktop */
@media (min-width: 1441px) {
  :root {
    --content-max: 1320px;
  }
}

/* Auth page styling */
.auth-page .app-shell,
.auth-page .sidebar,
.auth-page .topbar {
  display: none;
}

.auth-page body {
  background: linear-gradient(135deg, #1b2568, #090d23);
}

.auth-page .auth-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255,255,255,0.05);
  color: #f8fafc;
}

.auth-card h2 {
  margin: 0 0 18px;
  font-size: 2rem;
}

.auth-card p {
  color: #94a3b8;
  margin-bottom: 26px;
}

.auth-card form {
  display: grid;
  gap: 18px;
}

.auth-card input[type='text'],
.auth-card input[type='email'],
.auth-card input[type='password'] {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.07);
  color: #f8fafc;
  font-size: 1rem;
}

.auth-card input[type='text']:focus,
.auth-card input[type='email']:focus,
.auth-card input[type='password']:focus {
  outline: none;
  border-color: rgba(91, 123, 255, 0.6);
  background: rgba(91, 123, 255, 0.08);
}

.auth-card input::placeholder {
  color: #cbd5e1;
}

.auth-card .btn-primary {
  width: 100%;
}

.auth-card .link {
  color: #94a3b8;
  text-align: center;
}

.auth-card .link a {
  color: #7c3aed;
}

.auth-card .google {
  background: #3b82f6;
}

/* Admin support */
.admin-ticket-panel .table-scroll {
  overflow-x: auto;
  margin-top: 8px;
}

.admin-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.admin-table th {
  background: rgba(91, 123, 255, 0.14);
  color: #0f172a;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.admin-table td {
  vertical-align: top;
}

.ticket-id-cell {
  font-weight: 700;
  color: #312e81;
  white-space: nowrap;
}

.user-cell {
  display: grid;
  gap: 4px;
}

.user-cell strong {
  color: #0f172a;
}

.user-cell small {
  color: #64748b;
}

.date-cell {
  white-space: nowrap;
  color: #334155;
  font-size: 0.92rem;
}

.attachment-cell {
  min-width: 180px;
}

.attachment-name {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-weight: 600;
  margin-bottom: 8px;
}

.attachment-links,
.attachment-actions,
.admin-action-group,
.page-heading-actions,
.form-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.btn-ghost {
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.28);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.text-muted {
  color: #94a3b8;
  font-size: 0.92rem;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.priority-low {
  background: #e2e8f0;
  color: #334155;
}

.priority-medium {
  background: #dbeafe;
  color: #1d4ed8;
}

.priority-high {
  background: #ffedd5;
  color: #c2410c;
}

.priority-urgent {
  background: #fee2e2;
  color: #b91c1c;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.meta-chip {
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.meta-chip span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.meta-chip strong {
  color: #0f172a;
}

.admin-ticket-layout .ticket-panel p {
  margin-bottom: 12px;
}

.attachment-panel {
  display: grid;
  gap: 14px;
}

.attachment-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 18px;
  background: #fff;
}

.conversation-timeline .timeline-internal {
  background: rgba(99, 102, 241, 0.08);
  border-style: dashed;
}

.latest-reply {
  border-left: 4px solid #6366f1;
}

.conversation-bubble.support-reply {
  border-left: 4px solid #22c55e;
}

.conversation-bubble small {
  display: block;
  margin-top: 10px;
  color: #64748b;
}

.empty-row {
  text-align: center;
  color: #64748b;
  padding: 28px 16px;
}

@media (max-width: 1100px) {
  .ticket-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-action-group {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }

  .page-heading-actions {
    width: 100%;
  }
}

/* Two-way support conversation */
.conversation-thread {
  display: grid;
  gap: 16px;
}

.conversation-bubble {
  max-width: 92%;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.98);
}

.bubble-user {
  margin-right: auto;
  border-left: 4px solid #6366f1;
}

.bubble-admin {
  margin-left: auto;
  background: rgba(224, 231, 255, 0.95);
  border-left: 4px solid #4f46e5;
}

.bubble-system,
.bubble-internal {
  margin: 0 auto;
  max-width: 100%;
  background: rgba(241, 245, 249, 0.95);
  border-style: dashed;
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.bubble-header strong {
  color: #0f172a;
}

.bubble-header time {
  color: #64748b;
  font-size: 0.85rem;
  white-space: nowrap;
}

.bubble-body {
  margin: 0;
  color: #334155;
  line-height: 1.75;
  white-space: pre-wrap;
}

.bubble-tag {
  display: inline-block;
  margin-top: 10px;
  color: #7c3aed;
}

.conversation-status {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px 0;
}

.conversation-status time {
  color: #64748b;
  font-size: 0.85rem;
}

.conversation-status p {
  margin: 0;
  color: #64748b;
  text-align: center;
}

.attachment-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.attachment-card-name {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

.ticket-conversation-layout,
.admin-ticket-layout {
  align-items: start;
}

.conversation-panel-wide {
  min-height: 420px;
}

.reply-form textarea {
  min-height: 140px;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  font-size: 0.85rem;
  font-weight: 700;
}

.unread-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.2);
  vertical-align: middle;
}

.admin-table tr.row-needs-response {
  background: rgba(244, 63, 94, 0.08);
}

.admin-table tr.row-needs-response:hover {
  background: rgba(244, 63, 94, 0.12);
}
