.tickets-list-page {
  padding: 1.5rem 2rem;
}

.tickets-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tickets-list-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.btn-raise {
  padding: 0.5rem 1rem;
  background: var(--primary, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}

.btn-raise:hover {
  filter: brightness(1.05);
}

.tickets-list-loading,
.tickets-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary, #64748b);
}

.tickets-list-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.tickets-list-table-wrap {
  overflow-x: auto;
  background: var(--card-bg, #fff);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tickets-list-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-list-table th,
.tickets-list-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.tickets-list-table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
}

.tickets-list-table tbody tr:hover {
  background: var(--hover-bg, #f8fafc);
}

.ticket-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.ticket-status-open {
  background: #dbeafe;
  color: #1d4ed8;
}

.ticket-status-in-progress {
  background: #fef3c7;
  color: #b45309;
}

.ticket-status-resolved {
  background: #d1fae5;
  color: #047857;
}

.ticket-status-closed {
  background: #f1f5f9;
  color: #475569;
}

.btn-close-ticket {
  padding: 0.35rem 0.75rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-close-ticket:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-close-ticket:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ticket-closed-label {
  color: var(--text-secondary, #64748b);
  font-size: 0.85rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary, #3b82f6);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
}

.link-btn:hover {
  color: #2563eb;
}

/* ========== Mobile responsive ========== */
@media (max-width: 768px) {
  .tickets-list-page {
    padding: 1.25rem 1.25rem 2rem;
  }

  .tickets-list-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .tickets-list-header h1 {
    font-size: 1.35rem;
    text-align: center;
  }

  .tickets-list-header .btn-raise {
    width: 100%;
    padding: 0.75rem 1rem;
    min-height: 48px;
    border-radius: 10px;
  }
}

@media (max-width: 640px) {
  .tickets-list-page {
    padding: 1rem 1rem 1.75rem;
  }

  .tickets-list-header h1 {
    font-size: 1.25rem;
  }

  .tickets-list-table-wrap {
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  }

  .tickets-list-table {
    border: none;
  }

  .tickets-list-table thead {
    display: none;
  }

  .tickets-list-table tbody tr.tickets-list-row {
    display: block;
    padding: 1rem 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  .tickets-list-table tbody tr.tickets-list-row:last-child {
    margin-bottom: 0;
  }

  .tickets-list-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #f1f5f9);
    font-size: 0.9rem;
  }

  .tickets-list-table tbody td:last-child {
    border-bottom: none;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
  }

  .tickets-list-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary, #64748b);
    flex-shrink: 0;
  }

  .tickets-list-table tbody td[data-label="Actions"]::before {
    display: none;
  }

  .tickets-list-table tbody td[data-label="Actions"] {
    justify-content: stretch;
  }

  .tickets-list-table .btn-close-ticket {
    width: 100%;
    padding: 0.65rem 1rem;
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  .tickets-list-table tbody tr.tickets-list-empty-row td {
    display: block;
    padding: 2rem 1rem;
    border: none;
    text-align: center;
  }

  .tickets-list-table tbody tr.tickets-list-empty-row td::before {
    display: none;
  }

  .tickets-list-loading,
  .tickets-empty {
    padding: 1.5rem 1rem;
  }

  .tickets-list-error {
    border-radius: 10px;
    padding: 0.85rem 1rem;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .tickets-list-page {
  background: rgba(58, 56, 56, 0.95);
  min-height: 100%;
  padding: 1.5rem 2rem;
}
body.night-mode .tickets-list-header h1 {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .btn-raise {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
}
body.night-mode .tickets-list-loading,
body.night-mode .tickets-empty {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .tickets-list-error {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(248, 113, 113, 0.4);
}
body.night-mode .tickets-list-table-wrap {
  background: rgba(58, 56, 56, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body.night-mode .tickets-list-table th,
body.night-mode .tickets-list-table td {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.night-mode .tickets-list-table th {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .tickets-list-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.night-mode .ticket-status-open {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
body.night-mode .ticket-status-in-progress {
  background: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}
body.night-mode .ticket-status-resolved {
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}
body.night-mode .ticket-status-closed {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .btn-close-ticket {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}
body.night-mode .btn-close-ticket:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}
body.night-mode .ticket-closed-label {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .link-btn {
  color: #f87171;
}
body.night-mode .link-btn:hover {
  color: #fca5a5;
}
@media (max-width: 640px) {
  body.night-mode .tickets-list-table tbody tr.tickets-list-row {
    background: rgba(58, 56, 56, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
  }
  body.night-mode .tickets-list-table tbody td::before {
    color: rgba(255, 255, 255, 0.75);
  }
}
