:root {
  --bg: #f4f0ea;
  --bg-1: #fff7ef;
  --bg-2: #f4f0ea;
  --bg-3: #efe8df;
  --ink: #1f2328;
  --muted: #6c6f76;
  --panel: #ffffff;
  --accent: #eb5d3a;
  --accent-2: #1f6feb;
  --border: #e2ddd5;
  --shadow: rgba(30, 30, 30, 0.08);
  --ambient-1: rgba(235, 93, 58, 0.2);
  --ambient-2: rgba(31, 111, 235, 0.15);
  --topbar-bg: rgba(244, 240, 234, 0.9);
  --table-hover: #f5efe8;
  --ghost-hover-bg: #f5efe8;
}

body[data-theme="dark"] {
  --bg: #121317;
  --bg-1: #151822;
  --bg-2: #121317;
  --bg-3: #0f1218;
  --ink: #f2f4f7;
  --muted: #a7adb6;
  --panel: #1b1f26;
  --accent: #ff7a59;
  --accent-2: #74a5ff;
  --border: #2a303a;
  --shadow: rgba(0, 0, 0, 0.38);
  --ambient-1: rgba(255, 122, 89, 0.18);
  --ambient-2: rgba(116, 165, 255, 0.14);
  --topbar-bg: rgba(18, 19, 23, 0.88);
  --table-hover: #1f252e;
  --ghost-hover-bg: #202631;
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select:not([style]) {
  background: #141820;
  color: var(--ink);
  border-color: var(--border);
}

body[data-theme="dark"] .user-chip {
  background: #151922;
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .modal-card,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .permission-group,
body[data-theme="dark"] .message,
body[data-theme="dark"] .message.admin {
  background: var(--panel);
}

body[data-theme="dark"] .message {
  border-color: var(--border);
}

body[data-theme="dark"] .message.admin {
  background: #1a2333;
}

body[data-theme="dark"] .message.closing {
  background: #3a1b1b;
  border-color: #5a2b2b;
}

body[data-theme="dark"] .time-entry {
  background: rgba(18, 22, 30, 0.8);
}

body[data-theme="dark"] .admin-section {
  background: rgba(18, 22, 30, 0.75);
}

body[data-theme="dark"] .pill {
  background: #242a33;
  color: var(--ink);
}

body[data-theme="dark"] .pill.hidden,
body[data-theme="dark"] .pill.closed {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

body[data-theme="dark"] .dm-preview {
  background: #11141a;
  color: #e6e6ea;
}

body[data-theme="dark"] .permission-group,
body[data-theme="dark"] .stat-card {
  background: #151922;
}

body[data-theme="dark"] .participant-row {
  background: rgba(18, 22, 30, 0.8);
}

body[data-theme="dark"] .admin .table-wrap tr {
  background: #1b1f26;
}

body[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  color: var(--ink);
  min-height: 100vh;
}

a {
  color: var(--accent-2);
}

.ambient {
  position: fixed;
  inset: -20% -10%;
  background: radial-gradient(circle at 80% 10%, var(--ambient-1), transparent 45%),
    radial-gradient(circle at 10% 80%, var(--ambient-2), transparent 40%);
  z-index: -1;
  animation: float 18s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(18px);
  }
  100% {
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  position: sticky;
  top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  gap: 10px;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(235, 93, 58, 0.2);
}

.nav-links a {
  margin-right: 20px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px var(--shadow);
}

.user-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.main {
  padding: 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 30px var(--shadow);
  margin-bottom: 24px;
}

.panel-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

.panel h1,
.panel h2,
.panel h3 {
  margin: 0 0 8px;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
}

.panel p {
  margin: 0;
  color: var(--muted);
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.ghost:hover {
  background: var(--ghost-hover-bg);
  border-color: rgba(235, 93, 58, 0.45);
  box-shadow: 0 8px 18px rgba(31, 35, 40, 0.12);
  transform: translateY(-1px);
}

.ghost:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(31, 35, 40, 0.1);
}

.table-wrap {
  overflow-x: auto;
}

.table-value {
  display: none;
}

.ticket-summary {
  display: none;
}

.ticket-summary-title {
  font-weight: 600;
}

.ticket-summary-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ticket-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
  background: #eee2d8;
  border: 1px solid transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

tbody tr {
  height: 52px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

.settings-table .table-input {
  width: 100%;
  min-width: 160px;
}

.settings-table .table-number {
  width: 100%;
  min-width: 90px;
}

.panel.panel-conversation {
  margin: 0;
};

.color-input {
  width: 44px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.clickable-row td {
  transition: background 0.15s ease;
}

.clickable-row:hover td {
  background: var(--table-hover);
}

.clickable-row {
  cursor: pointer;
}

th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
  background: #eee2d8;
}

.pill.priority.low {
  background: #e6f3ea;
  color: #1f6f3d;
}

.pill.priority.normal {
  background: #e6f1fb;
  color: #1f4f7a;
}

.pill.priority.high {
  background: #fff0d9;
  color: #8a4b00;
}

.pill.priority.urgent {
  background: #ffe3e6;
  color: #8f1d2b;
}

.pill.open {
  background: rgba(31, 111, 235, 0.15);
  color: #1f6feb;
}

.pill.waiting {
  background: rgba(235, 93, 58, 0.18);
  color: #d94f2f;
}

.pill.closed {
  background: rgba(31, 35, 40, 0.1);
  color: #545a60;
}

.pill.hidden {
  background: rgba(31, 35, 40, 0.1);
  color: #545a60;
}

.panel-form.hidden {
  display: none;
}

.field,
.field-inline {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

input,
textarea,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
}

.table-select {
  width: 100%;
  min-width: 110px;
}

.table-select.status.open {
  background: rgba(31, 111, 235, 0.15);
  color: #1f6feb;
  border-color: rgba(31, 111, 235, 0.3);
}

.table-select.status.waiting {
  background: rgba(235, 93, 58, 0.18);
  color: #d94f2f;
  border-color: rgba(235, 93, 58, 0.35);
}

.table-select.status.closed {
  background: rgba(31, 35, 40, 0.1);
  color: #545a60;
  border-color: rgba(31, 35, 40, 0.2);
}

.table-select.priority.low {
  background: #e6f3ea;
  color: #1f6f3d;
  border-color: #b9d9c5;
}

.table-select.priority.normal {
  background: #e6f1fb;
  color: #1f4f7a;
  border-color: #b6cfe6;
}

.table-select.priority.high {
  background: #fff0d9;
  color: #8a4b00;
  border-color: #e6c79e;
}

.table-select.priority.urgent {
  background: #ffe3e6;
  color: #8f1d2b;
  border-color: #f2b2bb;
}

textarea {
  resize: vertical;
}

.dashboard .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-search {
  max-width: 220px;
  width: 100%;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.filters-toggle {
  display: none;
  margin-bottom: 8px;
}

.dm-template {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dm-preview {
  margin: 12px 0 16px;
  padding: 12px;
  border-radius: 12px;
  background: #1f1f24;
  color: #e6e6ea;
}

.webhook-preview {
  max-width: 520px;
}

.webhook-settings {
  padding-top: 14px;
  padding-bottom: 6px;
}

.dm-preview-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9a9aa4;
  margin-bottom: 8px;
}

.dm-preview-content {
  white-space: pre-wrap;
  margin-bottom: 10px;
}

.dm-preview-embed {
  border-left: 4px solid #4b6cb7;
  padding-left: 10px;
}

.dm-preview-embed-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.dm-preview-embed-description {
  white-space: pre-wrap;
  color: #d0d0d6;
}

.dm-preview-embed-image {
  display: none;
  width: 100%;
  margin-top: 10px;
  border-radius: 10px;
}

.dm-templates-save {
  margin-top: 10px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-link {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.side-link.sub-link {
  margin-left: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

.side-link.active {
  background: rgba(235, 93, 58, 0.12);
  border-color: rgba(235, 93, 58, 0.4);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

body[data-admin-tab] .tab-panel {
  display: none;
}

body[data-admin-tab="ticket-overview"] #ticket-overview,
body[data-admin-tab="assigned-tickets"] #assigned-tickets,
body[data-admin-tab="user-overview"] #user-overview,
body[data-admin-tab="settings"] #settings,
body[data-admin-tab="blacklist"] #blacklist,
body[data-admin-tab="analytics"] #analytics {
  display: block;
}

body[data-admin-tab] .side-link.active {
  background: var(--panel);
  border-color: var(--border);
}

body[data-admin-tab="ticket-overview"] .side-link[data-target="ticket-overview"],
body[data-admin-tab="assigned-tickets"] .side-link[data-target="assigned-tickets"],
body[data-admin-tab="user-overview"] .side-link[data-target="user-overview"],
body[data-admin-tab="settings"] .side-link[data-target="settings"],
body[data-admin-tab="blacklist"] .side-link[data-target="blacklist"],
body[data-admin-tab="analytics"] .side-link[data-target="analytics"] {
  background: rgba(235, 93, 58, 0.12);
  border-color: rgba(235, 93, 58, 0.4);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

.setting-row:last-child {
  border-bottom: none;
}

.permission-settings {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.admin-access-actions {
  margin-bottom: 14px;
}

.admin-access-actions .field-inline {
  gap: 10px;
  flex-wrap: wrap;
}

.admin-access-actions select {
  min-width: 220px;
}

.permission-group-list {
  display: grid;
  gap: 16px;
}

.permission-group {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
  background: #f7f3ef;
}

.permission-group-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permission-group-header .permission-name {
  flex: 1;
  min-width: 180px;
}

.permission-actions {
  display: flex;
  gap: 8px;
}

.permission-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.permission-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.permission-admins {
  margin-top: 18px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d0c9bf;
  border-radius: 20px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-section h3 {
  margin: 0;
  font-size: 16px;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  align-items: start;
}

.ticket-main {
  min-width: 0;
}

.ticket-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
}

.ticket-sidebar .panel {
  width: 100%;
}

.ticket-sidebar input,
.ticket-sidebar textarea,
.ticket-sidebar select {
  width: 100%;
  min-width: 0;
}

.participant-name .muted {
  word-break: break-all;
}

.ticket-sidebar .admin-controls {
  flex-direction: column;
  align-items: stretch;
}

.ticket-sidebar .field-inline {
  flex-direction: column;
  align-items: flex-start;
}

.admin-participants h3 {
  margin: 0 0 10px;
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.participant-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}

.participant-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.participant-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.participant-add {
  gap: 10px;
}

.participant-add select {
  min-width: 200px;
}

.ticket-time {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.time-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.time-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-entry {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.time-entry-meta {
  font-size: 12px;
  color: var(--muted);
}

.time-entry-note {
  font-size: 13px;
}

.ticket-sidebar-toggle {
  display: none;
  margin-bottom: 12px;
}

.ticket-sidebar-backdrop {
  display: none;
}

.stat-card {
  padding: 16px;
  border-radius: 16px;
  background: #f7f3ef;
  border: 1px solid var(--border);
}

.ticket-detail .messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 12px;
}


.message {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #faf7f2;
}

.message.message-reply {
  padding: 0;
  border: none;
  background: transparent;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.message.message-reply form {
  width: 100%;
}

.message.admin {
  background: #eef4ff;
}

.message.closing {
  background: #fde7e7;
  border-color: #f2baba;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-actions {
  display: flex;
  gap: 8px;
}

.message-delete {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
}

.message .avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.message-body p {
  margin: 8px 0;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 0.5rem;
  margin: 1rem 0 1rem 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
}

.reply-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.reply-icon:hover {
  background: var(--ghost-hover-bg);
  border-color: rgba(235, 93, 58, 0.45);
}

.reply-file {
  display: none;
}

.reply-input {
  flex: 1;
  display: flex;
}

.reply-input textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  border-radius: 0.5rem;
  padding: 10px 16px;
}

.reply-menu {
  position: relative;
}

.reply-menu-panel {
  position: absolute;
  right: 0;
  bottom: 52px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  box-shadow: 0 16px 30px var(--shadow);
  display: none;
  z-index: 20;
}

.reply-menu-panel.open {
  display: block;
}

.reply-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  font-size: 13px;
}

.reply-send {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
}

.modal-card {
  position: relative;
  max-width: 820px;
  margin: 8vh auto;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px var(--shadow);
}

.modal-content {
  margin-top: 12px;
}

.modal-content img,
.modal-content video {
  max-width: 100%;
  border-radius: 12px;
}

.modal-content video {
  max-height: 70vh;
}

.modal-close {
  float: right;
}

.login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.login-card {
  max-width: 420px;
  text-align: center;
  padding: 32px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 18px 40px var(--shadow);
}

.muted {
  color: var(--muted);
}

.panel-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .panel-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 16px;
  }
  .main {
    padding: 24px;
  }
  .ticket-layout {
    grid-template-columns: 1fr;
  }
  .ticket-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .ticket-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(360px, 86vw);
    background: var(--panel);
    border-left: 1px solid var(--border);
    padding: 24px 18px;
    box-shadow: -12px 0 30px var(--shadow);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 40;
    overflow-y: auto;
  }
  .ticket-sidebar .panel {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .ticket-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.45);
    border: none;
    padding: 0;
    margin: 0;
    z-index: 30;
  }
  .ticket-detail.sidebar-open .ticket-sidebar {
    transform: translateX(0);
  }
  .ticket-detail.sidebar-open .ticket-sidebar-backdrop {
    display: block;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 5px;
    padding-bottom: 0;
  }

  .panel {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 14px;
  }

  .admin-layout {
    gap: 16px;
  }

  .admin-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .side-link {
    flex: 0 0 auto;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .filters {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filters-toggle {
    display: inline-flex;
    align-self: flex-start;
  }

  .filters-panel {
    display: none;
  }

  .filters-panel.open {
    display: grid;
  }

  .table-search {
    max-width: 100%;
  }

  .admin .table-wrap {
    overflow: visible;
  }

  .admin .table-wrap thead {
    display: none;
  }

  .admin .table-wrap table,
  .admin .table-wrap tbody,
  .admin .table-wrap tr,
  .admin .table-wrap td {
    display: block;
    width: 100%;
  }

  .admin .table-wrap tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: #faf7f2;
    height: auto;
  }

  .admin .table-wrap td {
    border: none;
    padding: 4px 0;
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    overflow-wrap: anywhere;
  }

  .admin .table-wrap td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }

  .admin .table-wrap td > * {
    max-width: 100%;
  }

  .admin .table-wrap td select,
  .admin .table-wrap td input,
  .admin .table-wrap td textarea {
    width: 100%;
  }

  .admin .table-wrap td[colspan] {
    display: block;
    text-align: center;
    padding: 8px 0;
  }

  .admin .table-wrap td[colspan]::before {
    content: "";
  }

  #ticket-overview .table-wrap td {
    display: none;
  }

  #ticket-overview .table-wrap td.ticket-title-cell {
    display: block;
    border: none;
    padding: 0;
  }

  #ticket-overview .table-wrap td.ticket-title-cell::before {
    content: none;
  }

  #ticket-overview .ticket-title-text {
    display: none;
  }

  #ticket-overview .ticket-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #ticket-overview .table-wrap td[colspan] {
    display: block;
    padding: 8px 0;
  }

  #assigned-tickets .table-wrap td {
    display: none;
  }

  #assigned-tickets .table-wrap td.ticket-title-cell {
    display: block;
    border: none;
    padding: 0;
  }

  #assigned-tickets .table-wrap td.ticket-title-cell::before {
    content: none;
  }

  #assigned-tickets .ticket-title-text {
    display: none;
  }

  #assigned-tickets .ticket-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #assigned-tickets .table-wrap td[colspan] {
    display: block;
    padding: 8px 0;
  }

  #ticket-overview .table-value,
  #assigned-tickets .table-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  #ticket-overview .table-select,
  #assigned-tickets .table-select {
    display: none;
  }

  .admin .table-wrap .table-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .admin .table-wrap td {
    padding: 6px 0;
  }

  .field-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .ticket-layout {
    gap: 16px;
  }


  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .ticket-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .panel-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 0;
  }

  .ticket-detail .messages {
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 12px;
  }

  .message.message-reply {
    margin-top: auto;
  }

  .message {
    padding: 10px;
    gap: 8px;
    border-radius: 12px;
  }

  #message-list{
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .message .avatar img {
    width: 28px;
    height: 28px;
  }

  .message-body p {
    margin: 6px 0;
  }

  .reply-bar {
    gap: 8px;
  }

  .reply-icon {
    width: 36px;
    height: 36px;
  }

  .reply-send {
    height: 36px;
    padding: 0 14px;
  }
}
