:root {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b1220;
  --panel: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  --surface: rgba(15, 23, 42, 0.85);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.15);
  --input-bg: rgba(15, 23, 42, 0.7);
  --input-border: rgba(56, 189, 248, 0.55);
  --table-head: linear-gradient(90deg, rgba(30, 41, 59, 0.95), rgba(8, 47, 73, 0.95));
  --table-row: rgba(15, 23, 42, 0.85);
}

.theme-light {
  --bg: #f8fafc;
  --panel: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.96));
  --surface: rgba(255, 255, 255, 0.96);
  --text: #0f172a;
  --muted: #1f2937;
  --border: rgba(15, 23, 42, 0.12);
  --input-bg: rgba(255, 255, 255, 0.96);
  --input-border: rgba(15, 23, 42, 0.2);
  --table-head: rgba(226, 232, 240, 0.95);
  --table-row: rgba(248, 250, 252, 0.96);
}

body {
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

.theme-light .panel,
.theme-light .panel * {
  color: var(--text);
}

.theme-light .text-slate-400,
.theme-light .text-slate-500,
.theme-light .text-slate-300,
.theme-light .text-slate-200 {
  color: #1f2937 !important;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-radius: 9999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  box-shadow: 0 15px 30px rgba(14, 165, 233, 0.35);
  border: none;
}

.btn-secondary {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
}

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

.form-input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0.75rem 0.95rem;
  font-size: 0.97rem;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.12);
}

.form-input:focus {
  outline: none;
  border-color: rgba(6, 182, 212, 0.95);
  box-shadow:
    0 0 0 3px rgba(56, 189, 248, 0.18),
    0 18px 40px rgba(6, 182, 212, 0.18);
  background: var(--input-bg);
}

.form-input::placeholder {
  color: var(--muted);
}

.stat-card {
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.12), var(--surface));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card p {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  font-size: 2rem;
  font-weight: 600;
}

.ticket-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  cursor: pointer;
  transition: border 150ms, transform 150ms;
}

.ticket-card:hover {
  border-color: rgba(14, 165, 233, 0.8);
  transform: translateY(-2px);
}

.ticket-card .ticket-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.ticket-card .ticket-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.45rem 0 0.25rem;
}

.badge {
  border-radius: 9999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ticket-meta {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.pill {
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 0.25rem 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pill-active {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(14, 165, 233, 0.7);
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
}

.ticket-table-wrapper {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06);
  max-height: 30rem;
}

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

.ticket-table thead {
  position: sticky;
  top: 0;
  background: var(--table-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ticket-table th,
.ticket-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.ticket-table td {
  color: var(--text);
  vertical-align: top;
}

.ticket-table th {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: left;
}

.ticket-row {
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease, color 120ms ease;
  background: var(--table-row);
}

.ticket-row:hover {
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-1px);
}

.ticket-row.selected {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(59, 130, 246, 0.12));
  border-left: 3px solid rgba(14, 165, 233, 0.9);
}

.ticket-row.priority-urgent {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.18), rgba(239, 68, 68, 0.22));
  color: #1f2937;
}

.ticket-row.overdue {
  border-left: 4px solid #7f1d1d;
}

.staff-table-wrapper {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  overflow: auto;
  background: rgba(2, 6, 23, 0.75);
}

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

.staff-table th,
.staff-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  text-align: left;
}

.avatar-thumb {
  width: 108px;
  height: 108px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #e2e8f0;
}

.profile-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.form-input.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.profile-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-field span {
  min-width: 120px;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-field .form-input {
  flex: 1;
}

#change-password {
  max-width: 100%;
}

#change-password label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#change-password .form-input {
  width: 100%;
}

.staff-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
}

.staff-role-select {
  min-width: 9rem;
}

.ticket-row {
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.ticket-row:hover {
  background: rgba(56, 189, 248, 0.07);
  transform: translateY(-1px);
}

.ticket-row.selected {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(59, 130, 246, 0.12));
  border-left: 3px solid rgba(14, 165, 233, 0.9);
}

.ticket-cell-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ticket-cell-title .ticket-title {
  font-weight: 600;
  color: #e2e8f0;
}

.ticket-cell-title .ticket-desc {
  color: #94a3b8;
  font-size: 0.85rem;
}

.response-bubble {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.75rem 1rem;
  background: rgba(2, 6, 23, 0.8);
  max-width: 80%;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
  width: fit-content;
  align-self: flex-start;
}

.response-bubble-other {
  background: rgba(30, 41, 59, 0.9);
  margin-right: auto;
  color: #e2e8f0;
}

.response-bubble-mine {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.24));
  border-color: rgba(59, 130, 246, 0.5);
  margin-left: auto;
  align-self: flex-end;
  margin-right: 0;
  color: #f8fafc;
}

.response-author {
  font-size: 0.85rem;
  font-weight: 600;
}

.response-meta {
  font-size: 0.75rem;
  color: #94a3b8;
}

.employee-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1rem;
  background: rgba(15, 23, 42, 0.85);
  max-height: 240px;
  overflow: hidden;
}

.employee-card > div {
  overflow-y: auto;
  max-height: 140px;
}

.employee-card h4 {
  font-weight: 600;
  font-size: 1rem;
}

.employee-ticket {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.employee-ticket:last-child {
  margin-bottom: 0;
}

.employee-ticket.compact {
  font-size: 0.85rem;
}

.employee-ticket:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.08);
}

.employee-ticket .ticket-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.employee-ticket .ticket-title {
  font-weight: 600;
  color: #e2e8f0;
}

.employee-ticket .ticket-desc {
  color: #94a3b8;
  font-size: 0.8rem;
}

.employee-ticket .ticket-status {
  font-size: 0.78rem;
  color: #cbd5e1;
  white-space: nowrap;
}

.attachment-section {
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 1rem;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  align-items: start;
}

.attachment-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
}

.attachment-thumb {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.4);
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  max-height: 220px;
}

.attachment-thumb:hover,
.attachment-link:hover {
  border-color: rgba(56, 189, 248, 0.7);
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.attachment-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.55rem 0.75rem;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.5);
  text-align: left;
}

#responses {
  max-height: 70vh;
  min-height: 38vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
}

.chat-panel {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 1rem;
  min-height: 32rem;
}

.chat-form {
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 0.75rem;
}

.chat-thread {
  max-width: 65vw;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ticket-detail-layout {
  display: grid;
}

@media (min-width: 1024px) {
  .ticket-detail-layout {
    grid-template-columns: 35% 65%;
    align-items: start;
  }
}

.attachment-video {
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 0.35rem;
  background: rgba(15, 23, 42, 0.75);
  box-shadow: 0 8px 30px rgba(2, 6, 23, 0.35);
}

.attachment-video video {
  width: 100%;
  border-radius: 0.85rem;
  display: block;
}

.attachment-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.attachment-modal.hidden {
  display: none;
}

.attachment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
}

.attachment-modal img {
  position: relative;
  max-width: 80%;
  max-height: 80%;
  border-radius: 1rem;
  box-shadow: 0 25px 80px rgba(2, 6, 23, 0.6);
}

#cookie-banner {
  z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}
